我正在尝试使用以下命令导入到SQL Server 2008:
DECLARE @row_terminator CHAR;
SET @row_terminator = CHAR(10); -- or char(10)
DECLARE @stmt NVARCHAR(2000);
SET @stmt = '
BULK INSERT accn_ordered_tests
FROM ''e:\fullextract\accn_ordered_tests_201201270801.txt''
WITH
(
firstrow=2,
FIELDTERMINATOR = ''|'' ,
ROWS_PER_BATCH=10000
,ROWTERMINATOR='''+@row_terminator+'''
)'
exec sp_executesql @stmt;这条语句已经在数百个表中取得了令人难以置信的效果。
我在一张桌子上遇到了问题。以下是数据示例:
DD68|OXY-2|Oxycodone Panel|N||83925|FEE|TRICORTH|INC|||||1|N|N|||1|25.94|68.45|68.45|0|||N|48035|N||0|04/05/2011|N||69872|7739|12/13/2011 10:12:29|04/07/2011||0|0|||||0
D088|PCP-2|Phencyclidine panel|N||83992|FEE|TRIORTH|IWC|||||1|N|N|||1|19.6|51.7|51.7|0|||N|41636|N||0|04/05/2011|N||69873|7740|12/13/2011 10:12:29|04/07/2011||0|0|||||0
D858|PPX-2|Propoxyphene panel|N||83925|FEE|TRIORTH|IWC|||||1|N|N|||1|25.94|68.45|68.45|0|||N|41037|N||0|04/05/2011|N||69874|7741|12/13/2011 10:12:29|04/07/2011||0|0|||||0
DD68|TAP-2|Tapentadol panel 80299|N||80299|FEE|TRICATH|INC|||||1|N|N|||1|1|48.18|48.18|0|||N|48038|N||0|04/05/2011|N||69875|7745|12/13/2011 10:12:29|04/07/2011||0|0|||||0我得到了这个错误:
Msg 4866, Level 16, State 1, Line 2
The bulk load failed. The column is too long in the data file for row 72294, column 36. Verify that the field terminator and row terminator are specified correctly.
Msg 7399, Level 16, State 1, Line 2
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 2
Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".有人知道我做错了什么吗?
下面是有问题的行:
D858|PCP-2|Phencyclidine panel|N||83992|FEE|TRICARRTH|INC|||||1|N|N|||1|19.6|51.7|51.7|0|||N|4168036|N||0|04/05/2011|N||69873|7740|12/13/2011 10:12:29|04/07/2011||0|0|||||0当我尝试执行导入数据向导时,我得到了以下错误:
overflowed the disk I/O buffer for column audit_date发布于 2012-02-01 04:35:20
LIkely您有一个错误的文件。要求供应商重新发送它。
https://stackoverflow.com/questions/9071783
复制相似问题