如果最后一列为空,则BCP错误

时间:2018-01-25 15:22:28

标签: bcp

如果数据文件中的最后一列为空,则我的bcp应用程序出错。这会导致错误:

XX,YY,42,0,2,201501,652,,

这不是:

XX,YY,42,0,2,201501,652,,0

不幸的是我不能指定零而不是null。目标表允许每列都为null。数据类型是float(实际上最后三列是浮点数)。这是格式文件:

8.0
9
1       SQLCHAR       0       10      ","                       1     NOT          SQL_Latin1_General_CP1_CI_AS
2       SQLCHAR       0       10      ","                       2     VIOLATING    SQL_Latin1_General_CP1_CI_AS
3       SQLCHAR       0       10      ","                       3     COMPANY      SQL_Latin1_General_CP1_CI_AS
4       SQLCHAR       0       2       ","                       4     POLICY       SQL_Latin1_General_CP1_CI_AS
5       SQLCHAR       0       2       ","                       5     ON           SQL_Latin1_General_CP1_CI_AS
6       SQLCHAR       0       6       ","                       6     INFORMATION  SQL_Latin1_General_CP1_CI_AS
7       SQLCHAR       0       25      ","                       7     SECURITY     ""
8       SQLCHAR       0       25      ","                       8     QTY2         ""
9       SQLCHAR       0       25      "\n"                      9     QTY1         ""

错误:

Row 1, Column 9: Invalid character value for cast specification

0 个答案:

没有答案