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 2005 Forums
 Transact-SQL (2005)
 bcp to generate csv

Author  Topic 

syscents
Starting Member

4 Posts

Posted - 2009-12-14 : 11:35:41
Hi! I have an issue and I haven't found any information. I wish anybody give me some help. The question is:

I want to export a table to csv. I want to use bcp command to generate a csv file. I set the delimiter ',' (or what you want). The problem is that if any field has ',' char, it breaks the bulk insert... So is there any way to convert the delimiter chars inside the csv file? I don't want to change delimiter because if I change to ';', maybe there is any ';' inside the textfield.

Thank you

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-12-14 : 13:17:08
change it to something that you're certain is not in the data set. i typically use a tab character, but you could use anything...char(191) if it's not spanish language, for example...
Go to Top of Page

syscents
Starting Member

4 Posts

Posted - 2009-12-15 : 02:39:39
It's a workarround but I would prefer convert to another charset for example. For example ISO-8859
Go to Top of Page
   

- Advertisement -