我试图将制表符分隔文件导入到SQL中。 DB中的一个字段是decimal(15,2)
。但是我收到的文件可能有一些指数值,如-2.702159776E17
,这显然不适合我在数据库中的字段。当数值超出范围错误发生10次时,BCP文件未完全加载
问题是如果该指数文件超过10条记录,BCP未在完整数据中加载。只要遇到指数值的第10个实例,就会跳过文件的其余部分。
我使用下面的命令BCP加载数据:
dbname.dbo.tablename in "filelocation" -c -F 2 -b 10000 -h "TABLOCK" -T -S servername
文件我想进口已经有20万分的记录。但是我们可以清楚地看到它只处理了18,000条记录,其余都被跳过了。 BCP的输出如下。
Starting copy...
SQLState = 22003, NativeError = 0
Error = [Microsoft][SQL Server Native Client 11.0]Numeric value out of range
SQLState = 22003, NativeError = 0
Error = [Microsoft][SQL Server Native Client 11.0]Numeric value out of range
SQLState = 22003, NativeError = 0
Error = [Microsoft][SQL Server Native Client 11.0]Numeric value out of range
SQLState = 22003, NativeError = 0
Error = [Microsoft][SQL Server Native Client 11.0]Numeric value out of range
SQLState = 22003, NativeError = 0
Error = [Microsoft][SQL Server Native Client 11.0]Numeric value out of range
SQLState = 22003, NativeError = 0
Error = [Microsoft][SQL Server Native Client 11.0]Numeric value out of range
SQLState = 22003, NativeError = 0
Error = [Microsoft][SQL Server Native Client 11.0]Numeric value out of range
SQLState = 22003, NativeError = 0
Error = [Microsoft][SQL Server Native Client 11.0]Numeric value out of range
SQLState = 22003, NativeError = 0
Error = [Microsoft][SQL Server Native Client 11.0]Numeric value out of range
SQLState = 22003, NativeError = 0
Error = [Microsoft][SQL Server Native Client 11.0]Numeric value out of range
18149 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.) Total : 265 Average : (68486.79 rows per sec.)
完美,谢谢 – Kesava