Monday, 24 September 2012

SQL BCP outputting ÿ instead of spaces

Came across this today - a stored procedure of ours that bcp's out some data to a csv file started generating ÿ characters instead of spaces (the two dots being a German umlaut). Firing off the stored procedure manually did not show this character in the results window.

I could not find anything about it on the internet and it took a wee while of trial and error, but I eventually hit it lucky by changing following bcp statement from:


to:


The fixer is the change from -c to -w, using Unicode characters instead of a character data type. More on the tech of BCP here.