I'm trying to set up a nightly data transfer on my SQL Server. I need to export the contents of a table to a CSV file. I felt like BCP would probably be the easiest way to do it, but I can't seem to figure out how to get the file to be comma delimited. When I BCP to a .txt file, it looks like this:
which would be great, except that I need it to be comma delimited. When I BCP to a .csv file and open it in Excel, all I get is garbage. When I open it in Notepad, it looks like the above example. Is there some command in BCP where I can specify to use a comma as the delimiter? Also, (even though you can't tell above) there are NULLS in between some of the values. I need to be able to retain them in the BCP "output".
Here is my BCP command:
Is BCP the best way to get this done? I thought about using DTS packages, but I've never really fooled with them either. Any help or ideas would be appreciated!
Thanks!
Hope This Helps!
Ecobb
"My work is a game, a very serious game." - M.C. Escher
Code:
1 0005 I 1367107 1 F34115 1
2 0005 I 1367108 1 F34115 1
3 0005 I 1367109 1 F34115 1
4 0005 I 1370819 1 F16594 1
Here is my BCP command:
Code:
bcp "Select * From Database..Table" queryout "C:\whatever\test.csv" -c -Uuser -Ppassword
Thanks!
Hope This Helps!
Ecobb
"My work is a game, a very serious game." - M.C. Escher