sql server - 批量插入错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13713351/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
sql server - bulk insert error
提问by Bruce
I am using bulk insert and getting below error:
我正在使用批量插入并收到以下错误:
Note: The data in the load file is notbeyong the configured column length
注意:加载文件中的数据不超过配置的列长
Running Command:
运行命令:
bulk insert load_data from 'C:\temp\dataload\load_file.txt' with (firstrow = 1, fieldterminator = '0x09', rowterminator = '\n',MAXERRORS = 0, ERRORFILE = 'C:\temp\dataload\load_file')
从 'C:\temp\dataload\load_file.txt' 批量插入 load_data 与 (firstrow = 1, fieldterminator = '0x09', rowterminator = '\n',MAXERRORS = 0, ERRORFILE = 'C:\temp\dataload\load_file ')
Contents of load file:
加载文件的内容:
user_name file_path asset_owner city import_date
admin C:\ admin toronto 04/12/2012
Error:
错误:
Msg 4863, Level 16, State 1, Line 1
Bulk load data conversion error (truncation) for row 1, column 6 (validated).
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7330, Level 16, State 2, Line 1
Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".
消息 4863,级别 16,状态 1,第 1
行,第 1 行第 6 列(已验证)的批量加载数据转换错误(截断)。
消息 7399,级别 16,状态 1,第 1 行
链接服务器“(null)”的 OLE DB 提供程序“BULK”报告了错误。提供者没有提供有关错误的任何信息。消息 7330,级别 16,状态 2,第 1
行无法从链接服务器“(空)”的 OLE DB 提供程序“BULK”中获取一行。
回答by Bruce
The number of columns was incorrect. I had recently changed the table schema but forgotten to do a refresh on the table.
列数不正确。我最近更改了表架构,但忘记刷新表。
回答by Bruce
I solved the same problem by changing the data type in the schema. I had date type changed to nvarchar... It worked
我通过更改架构中的数据类型解决了同样的问题。我将日期类型更改为 nvarchar ......它有效