Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 issue: Inserting csv file - demiliter '',''

Author  Topic 

clir
Starting Member

6 Posts

Posted - 2006-04-09 : 11:43:00
Hi,

I've a .csv file and I want to import it into a table on SQL Server 2005.
The columns in the file are delimited with commas ','

My issue is that in a few comments columns, the user may have entered a comma within his string.

Do you have an idea how I can cope with that? How to say to Integration Services: 'Insert this file where columns are delimited by commas but be carefull when there's a comma in a comment field???'

Any help much appreciated,


Chris

nr
SQLTeam MVY

12543 Posts

Posted - 2006-04-09 : 12:00:37
If there is possiblility of a comma in a field then the field should be quote delimitted i.e. enclosed in "". Otherwise there is no way of telling where the field ends.
Have a look at this for dealing with quote delimitted files.
http://www.nigelrivett.net/SQLTsql/BCP_quoted_CSV_Format_file.html

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -