sql server bcp import和float type right data truncation

时间:2021-04-03 16:34:36

I have a table A and it has column CA with datatype float and contains a data like 35,44113. I have exported it with bcp out functionality as follows; In my exported .csv file data is exported as 35.44113

我有一个表A,它有列CA,数据类型为float,包含35,44113之类的数据。我已经使用bcp out函数导出它,如下所示;在我导出的.csv文件中,数据导出为35.44113

bcp <tablename> out <path> -U <username> -P <password> -S <servername> -c -Ccp1254 -t "|" 

when I wanted to import it as;

当我想导入它时;

bcp <tablename> in <path> -U <username> -P <password> -S <servername> -c -Ccp1254 -t "|"

and it gives me string data right truncation bcp error. Using SQL SERVER 2008 R2

它给我字符串数据右截断bcp错误。使用SQL SERVER 2008 R2

Any help?

Thanks

1 个解决方案

#1


1  

String data right truncation error suggested to me that your field lengths are greater than your table column definitions.

字符串数据右截断错误向我建议您的字段长度大于表列定义。

If you add -e error_file.txt to your bcp command it will provide more details of the error. e.g:

如果将-e error_file.txt添加到bcp命令,它将提供错误的更多详细信息。例如:

#@ Row 16, Column 15: String data, right truncation @#

#@第16行,第15列:字符串数据,右截断@#

From this you can adjust your table based on the file's data

从这里你可以根据文件的数据调整你的表

#1


1  

String data right truncation error suggested to me that your field lengths are greater than your table column definitions.

字符串数据右截断错误向我建议您的字段长度大于表列定义。

If you add -e error_file.txt to your bcp command it will provide more details of the error. e.g:

如果将-e error_file.txt添加到bcp命令,它将提供错误的更多详细信息。例如:

#@ Row 16, Column 15: String data, right truncation @#

#@第16行,第15列:字符串数据,右截断@#

From this you can adjust your table based on the file's data

从这里你可以根据文件的数据调整你的表