Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 BULK INSERT

Author  Topic 

avmreddy17
Posting Yak Master

180 Posts

Posted - 2009-05-13 : 19:22:10
If the Column datatyps is INT,BIT,DATETIME and if I have the
NULL Values in the text file I am importing it throwing an Error
"Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 1 (Sno)."

Is there a way to get around this.

Below are the sample scripts..

CREATE TABLE ZZZ
(
Sno INT ,
DD DATETIME ,
Name VARCHAR(30),
BitCol BIT
)

My Text File(test.txt)
NULL|06/30/2009|TEST|1|



BULK INSERT CTS.dbo.ZZZ
FROM 'C:\test.txt'
WITH
(
FIELDTERMINATOR = '|',
ROWTERMINATOR = '|\n',
CODEPAGE = 'RAW',
FIRSTROW = 1
)

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-05-14 : 11:19:09
http://technet.microsoft.com/en-us/library/ms187887.aspx
Go to Top of Page
   

- Advertisement -