我正在尝试使用以下方法导入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
当我尝试进行IMPORT DATA WIZARD时,我收到了以下错误:
overflowed the disk I/O buffer for column audit_date
答案 0 :(得分:1)
你可能有一个糟糕的文件。请供应商重新发送。