January 19, 2009 at 3:39 pm
Hello all
I have cvs file format like this "0160","Abbeville","003",5,2
How to use Bulk insert with file format "" and with out in cvs file into sql table?
I use query below, I got error = Got error
Bulk load data conversion error (truncation) for row 2, column 4 (Quantity).
Msg 4863, Level 16, State 1, Line 17
BULK INSERT dbo.Test_new
FROM '\\test\Counts.csv'
WITH
(
DATAFILETYPE = 'CHAR',
FIRSTROW = 2,
FIELDTERMINATOR = '","',
ROWTERMINATOR = ''
)
Go
"0160","Abbeville","003",5
Got error
Bulk load data conversion error (truncation) for row 2, column 5 (Quantity).
Msg 4863, Level 16, State 1, Line 17
January 19, 2009 at 3:48 pm
If your files are not very big it's easier to set up linked server connection to text files using ODBC driver.
That driver interpretes quoted values correctly.
_____________
Code for TallyGenerator
January 19, 2009 at 5:38 pm
Hi Sergiy,
My file is big. Do you have good way to do bulk insert? Thank you for help
LD
January 19, 2009 at 6:39 pm
Yes... create a format file. \" is the escape character for a single quote in the delimiter column. First character in the datafile must have a length of 1 and not be imported if it is a quote.
Also, what are you calling a "big file"?
--Jeff Moden
Change is inevitable... Change for the better is not.
January 19, 2009 at 6:50 pm
We discussed this matter on this forum several times.
Here are couple of links for you:
http://www.sqlservercentral.com/Forums/Topic18289-8-2.aspx
http://www.sqlservercentral.com/Forums/Topic296166-8-2.aspx
_____________
Code for TallyGenerator
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply