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
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 BULk insert handling NULLs in int column.

Author  Topic 

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2003-11-02 : 02:54:38
I have a table with followoing structure
CREATE TABLE T1
(ID INT,
NAME VARCHAR(50))


I want to insert the following text file in the table

1 RAVI
NULL SURESH

i am using the following query
bulk insert T1 from "c:\SURESH\X.txt"
with
(fieldterminator='\t',rowterminator='\n')


I am getting the following error
Server: Msg 4864, Level 16, State 1, Line 1
Bulk insert data conversion error (type mismatch) for row 2, column 1 (ID).


Any solutions for this error?

Thanks in advance.
Ravi Lobo







nr
SQLTeam MVY

12543 Posts

Posted - 2003-11-02 : 03:10:01
try
1 RAVI
SURESH

otherwise see
http://www.nigelrivett.net/ImportTextFiles.html

Which imports into a single column table and copies the data from there.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -