0

How do I specify column separator with "," for bcp or this code below

bcp [wwtest].[accesscontrol].[Roles] out C:\test\bcp_outputTable.csv -SPC01 -T -c 

2 Answers 2

2

Try adding -t, . See following documentation : https://msdn.microsoft.com/en-us/library/ms191485.aspx and https://msdn.microsoft.com/en-us/library/ms162802.aspx

0
2

The command lines below illustrate how to export data using a comma (,) or vertical pipe (|) as a field separator:

Export using comma:

BCP [Database].[Schema].[Table] out C:\FOLDERNAME\FILENAME.DAT -c -t, -S SERVERNAME -T

Export using vertical pipe:

BCP [Database].[Schema].[Table] out C:\FOLDERNAME\FILENAME.DAT -c -t^| -S SERVERNAME -T

The vertical pipe is different because it must be escaped. Quoting -t| will not work. I hope this helps.

Please note command line switches are case sensitive.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.