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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch Insert - delimiters, weird problem.

Status
Not open for further replies.

MrPeds

Programmer
Jan 7, 2003
219
0
0
GB
Hi,

I am using SQL Server DTS Batch Insert tool to populate a table from a csv file.

A comma is the column delimiter, CRLF the row delimiter, and the text is separated using quotes. For example:

"col1", "col2", "col3"
"someText", "moreText", "evenMoreText"

However, when i get something like this:

"col1", "col2", "col3"
"someText", "more,Text", "evenMoreText"

The insert does not work properly. The data in the second column is broken up, so instead of getting "more,Text" in one of my SQL tables columns I get "more" in col2 and "Text" in col3, e.g. in my SQL table i get:

"col1", "col2", "col3", "col4"
"someText", "more", "Text", "evenMoreText"

This is clearly wrong. SQL seems to be picking up the comma in a string when it shouldn't be, is there a workaround for this?

Should I simply use a DataTransformation instead?

Thanks,

MrPeds
 
Hi,
Have you checked your source data for fields containing "DOUBLE QUOTES"?
 
Hi,

I got my solution to work in the end, i simply changed the data source to a Text source connection and it went through without any problems.

I used a format file before but that did not seem to make any difference.

MrPeds
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top