我在将数据批量插入我的 SQL Express 2005 数据库时遇到问题。
我正在使用以下代码:
BULK INSERT [dbEPi].[dbo].[postcode]
FROM 'C:\Development\postnummerRegister.txt'
WITH
(
FIELDTERMINATOR = '\t',
ROWTERMINATOR = '\n'
)
我收到以下错误:
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 5. 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)".
我要导入的数据文件可以位于此处。
任何帮助都得到了重视。
更新 1 这是我正在使用的数据示例:
0001 OSLO 0301 OSLO K
0010 OSLO 0301 OSLO F
0014 OSLO 0301 OSLO K
0015 OSLO 0301 OSLO K
0016 OSLO 0301 OSLO K
0017 OSLO 0301 OSLO K
0018 OSLO 0301 OSLO G
0020 OSLO 0301 OSLO K
0021 OSLO 0301 OSLO K
更新 2
我现在设法导入它们。我所做的只是将文本复制到一个新文件中,并将其保存为 test.txt。我不知道为什么会这样。这可能是因为文件编码。该文件采用 UTF8 编码。