Well, after looking around the web this is what I found. Thought to put it in SO so more people have access to it.
http://www.techtalkz.com/microsoft-sql-server/147106-how-export-empty-strings-via-bcp.html
But when I run bcp, the empty strings are written to the text file
using the ASCII "NUL" character (0x0). Instead, I want the field to be
filled with blanks (0x20).
Solution:
In a text file, an empty string is interpreted as NULL when you bulk
in data. The NUL character is interpreted as the empty string, so
there is consistency. But that does not help much if you are exporting
data to another system....
Simply wrap around a NULLIF
that field that is possibly empty in the database and make it catch ''
and replace with NULL
. That will get converted into ^^values^^^^more values^^and more^^ so you get double separator with an blank instead of the NUL character.
E.g.:
...
NULLIF(pri.InstanceName, '') as PerformanceInstanceName,
...
Hope this helps someone.