这让我感到非常奇怪的行为,我花了一段时间检查代码中的bug,然后发现了以下内容
out从数据库表或视图复制到文件。如果指定现有文件,该文件将被覆盖。提取数据时,请注意bcp实用程序将空字符串表示为null,将空字符串表示为空字符串。(来自http://msdn.microsoft.com/en-us/library/ms162802.aspx)
显然,这让我解决了我的问题,但有谁能想到或者知道为什么会出现这种情况?
发布于 2017-02-25 02:59:46
SELECT ARTICULO as Articulo,
case when rtrim(CCOLOR) = '' then null else rtrim(CCOLOR) end as Color,
case when rtrim(TALLE) = '' then null else rtrim(TALLE) end as Talle,
from precios发送null代替empty。
我在这里找到了最佳解决方案:
https://bytes.com/topic/sql-server/answers/143738-bcp-inserting-blank-space-empty-string
我找到了一个解决办法,在
查询中使用Case结构将空字符串更改为null。BCP反过来将结果null输出为空!谢谢你的帮助。Eric
https://stackoverflow.com/questions/1644731
复制相似问题