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 2008 Forums
 Transact-SQL (2008)
 Sql bulk insert

Author  Topic 

ronjohn
Starting Member

4 Posts

Posted - 2010-07-28 : 22:39:30
Something strange is going on with my bulk insert. I'm trying to insert a csv document with 20000 records but the message i get back is "1 row affected" each time. It appears that data was inserted into to each column but the last column has the reminder of the data which is virtually all data. Can you help? Here's the my script.

BULK INSERT TempContacts
FROM 'C:\East1-4-29.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n\r'
)


Thanks,

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-28 : 23:35:30
It's likely that your rowterminator is wrong then. Try \r\n instead as that's much more common than \n\r. If that doesn't work, use a hex editor to verify what you've got for terminators.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

ronjohn
Starting Member

4 Posts

Posted - 2010-07-29 : 19:51:12
Thank you very much for your reply. I've tried it both ways and I've check the hex. But for whatever reason all data is going into the last column.
Go to Top of Page
   

- Advertisement -