SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Bulk Insert Huge CSV
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

patelb
Starting Member

16 Posts

Posted - 08/14/2008 :  13:45:50  Show Profile  Reply with Quote
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

USA
36565 Posts

Posted - 08/14/2008 :  14:00:12  Show Profile  Visit tkizer's Homepage  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000