Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Bulk Insert FieldTerminators!!!

Status
Not open for further replies.

chenthorn

Programmer
May 16, 2002
18
US
I have a 38 column table that I am trying to write a sproc that will insert a text file into it. I have been doing this via dts, but want to do it in tsql.
The text data looks like this:
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","000097170","","","","","","D"
a double-quote, one space, another double quote, and then the comma denote an empty string.
when I use this code to import the data:
BULK INSERT TNBLRaw.dbo.L011558100_20020515
FROM '\\tnbl\d\test\test1.raw'
WITH ( ROWTERMINATOR = '\n',
DATAFILETYPE = 'char',
CODEPAGE = 'raw',
FieldTerminator = '","')
The data is imported fine except for a double quote which is inserted into the first column.
Is there a way to get that double quote out of the first column? Why do I not have this problem when I use DTS to copy the file in via a data pump?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top