我正在努力使这个bcp工具以特定的方式工作. -c开关应该使用chars导出,但是由于某种原因,在记事本中有一个奇怪的字符,就像是UNICODE或其他一些格式.
解决方法
好吧,看了看网路这是我发现的.想把它放在SO里,所以更多的人都可以使用它.
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).
解:
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….
简单地围绕一个NULLIF该数据库中可能为空的字段,并将其捕获并替换为NULL.这将被转换为^^值^^^^更多的值^^和更多^^所以你得到一个空格而不是NUL字符的双分隔符.
例如.:
... NULLIF(pri.InstanceName,'') as PerformanceInstanceName,...
希望这有助于某人.