Hello,
I want to insert data using BULK INSERT command/BCP utility in Sql Server 2000/2005.
Table structure is as follows
The statement used to bulk insert data isCode:CREATE TABLE STUDENT ( STUDENTID INT IDENTITY(1, 1), -- PRIMARY KEY, [NAME] NVARCHAR(50), AGE INT, ENROLLMENTDATE DATETIME, STIPEND FLOAT, IsAvtive BIT )
The data in TestFile.txt isCode:BULK INSERT STUDENT FROM 'd:\Jehanzeb\TestFile.txt' WITH (DATAFILETYPE = 'char', FIELDTERMINATOR = ',', TABLOCK)
The error messges encountered areCode:-1, Jehanzeb Musani, 27, 1979-12-28T23:45:12.350, 250.25, null -1, Rizwan Ahmed, 26, 1980-09-08T23:45:12.150, 250.76, null
If the value of last column (IsActive) is anythig except null, the data is inserted into the table successfully bu BULK INSERT command.Code:Server: Msg 4864, Level 16, State 1, Line 1 Bulk insert data conversion error (type mismatch) for row 1, column 6 (IsAvtive). Server: Msg 4864, Level 16, State 1, Line 1 Bulk insert data conversion error (type mismatch) for row 2, column 6 (IsAvtive).
Can anyone please tell me how can I insert null in columns of type BIT using BULK INSERT command?
Thanking in advance.
Regards,
Jehanzeb




Reply With Quote