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)
 bcp import comma delimited

Author  Topic 

dgaylor
Yak Posting Veteran

54 Posts

Posted - 2003-08-21 : 16:28:08
Is it possible to bcp import a comma delimited file that has quotes around the fields, so that the quotes don't end up in the table? Thanks.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-08-21 : 16:42:05
I don't think that bcp can do this. Just run bcp /? in a cmd window to see the options. I don't see a text qualifier option. DTS allows the text qualifier option though.

Tara
Go to Top of Page

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2003-08-21 : 17:27:32
Files like this cause so much headache. It's not "comma delimited" if the fields are enclosed in quotes, is it. But yes, DTS does allow for this.

Jonathan
{0}
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-08-21 : 17:30:11
Well in DTS, you could have a comma delimited file and also have quotes around the text columns. bcp doesn't allow this, at least as far as I can tell. The quotes aren't delimiters, but rather an indication to the import/export program of which columns are text (meaning varchar, char, etc...).

Tara
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-08-21 : 20:56:42
You can work around it with this technique:

http://www.sqlteam.com/item.asp?ItemID=3207

Also, you may want to try using a bcp format file. I haven't tried incorporating quotes into the column terminators, but I think it will let you do it. See Books Online for a sample of format file layout. The column terminator would be something like "",""
Go to Top of Page

dgaylor
Yak Posting Veteran

54 Posts

Posted - 2003-08-22 : 14:40:42
thanks for the great info.
Go to Top of Page
   

- Advertisement -