0

我写了一个查询,将 .lst 文件中的数据插入表名 AxisATM 但是当我尝试插入时,它给了我错误

当我从 LST 文件中删除所有行时,除了 First ..它给了我 Success msg 说 1 rows changed..

Msg 4866, Level 16, State 1, Line 1
The bulk load failed. The column is too long in the data file for row 1, column 36. Verify that the field terminator and row terminator are specified correctly.
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)".

询问 :-

    BULK
INSERT dbo.ATMAxis
FROM 'c:\AGS_WINCORE_120901.lst'
WITH
(
FIELDTERMINATOR = '|',
ROWTERMINATOR = 'CHAR(13)'
)
GO

AGS_WINCORE_120901.lst:-

PRO1|......|00000000000|0| {Like it has 36 '|' separators}

使用记事本++ 我知道行尾字符是 CR LF

4

3 回答 3

2

不出所料,问题出在

ROWTERMINATOR = 'CHAR(13)'

我已将其更改为

ROWTERMINATOR = '0x0A'
于 2012-09-07T12:56:56.257 回答
0

正如错误所说,第 36 列的字符比表列的第 36 列的字符多。您需要增加该列的大小

于 2012-09-07T12:14:33.207 回答
0

似乎行终止符会产生问题。如果是这种情况,尝试更换/r/nChar(10)会解决问题。另外,检查char(13).

这个 MSDN 线程有更多信息。

于 2012-09-07T12:29:37.963 回答