October 25, 2010 at 8:24 am
Greetings experts
I am trying to user BULK INSERT to import a .csv file into sql server db.
BULK INSERT dbo.Account FROM 'T:\CSV\filename.csv'
WITH ( FIELDTERMINATOR = ',', ROWTERMINATOR = '' )
I am not getting any errors. However, nothing is getting inserted into the database.
Data from csv file is comma delimited.
Moreover, I have a fieldname called notes which has , (comma) and this is also throwing data off.
Any help is highly appreciated.
October 25, 2010 at 8:38 am
simflex-897410 (10/25/2010)
Moreover, I have a fieldname called notes which has , (comma) and this is also throwing data off.
For the delimiter issue, I typically try to use delimiters that either (1) are not commonly used (the pipe "|" character, for example), or (2) aren't typically found on a keyboard (which necessitates using something like ASCII character functions).
Also, if your fields use quotes, maybe you can set your delimiters to include them (e.g. "\", \""). I'm using a bulk import config file where I have to account for that.
Hope this helps.
+--------------------------------------------------------------------------------------+
Check out my blog at https://pianorayk.wordpress.com/
October 25, 2010 at 9:27 am
Chances are the comma is what's making the insert not work properly. You need to either regenerate your csv file with different delimiters, regenerated it with text qualifiers (so the comma doesn't confuse it), or manually go into the file and update your delimiters / text fields.
Assuming you don't miss anything, the file should then upload just fine.
October 25, 2010 at 12:58 pm
In order to find out what exactly column and row don't get inserted, add an option Errorfile = 'C:\folder\file.txt'
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply