bcp to CSV 0x00 character issues – NUL in Notepad++

I tried every bcp option under the sun trying to get rid of the NUL characters that kept cropping up in my CSV file from a bcp export. Finally stumbled on the solution here: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=131426

I wrapped the columns causing the problem with a NULLIF(column, ”) as suggested in the forum post and that worked like a champ.

bcp "select * from ##MessageRights" queryout c:\Scripts\MessageRights.csv -w -t, -T -E -k -S SERVERNAME


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s