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 Huge CSV

Author  Topic 

patelb
Starting Member

16 Posts

Posted - 2008-08-14 : 13:45:50
Im using this command to insert a CSV file into a table:
BULK INSERT sometable
FROM 'c:\somefile.txt'
WITH
(
FIRSTROW = 2,
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'

)

The CSV file is 70MB. I cannot get the file inserted into the table because I keep getting errors like:

Bulk load data conversion error (type mismatch or invalid character for the specified codepage)

I think it has to do with special characters such as '/','\','-' being in the data. Is there way to structure the bulk insert statement so it wont blow up if it hits a special character?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-08-14 : 14:00:12
Yes you can use a format file. Check BOL for details.

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

Subscribe to my blog
Go to Top of Page
   

- Advertisement -