0
我有一個文本文件,它包含以下相關信息:一些錯誤,而試圖BULK-INSERT
1,Blabla,Bla,Munich, Entwickler
2,artin,Rosner,Chemnitz,Entwickler
3,Sebastian, Leuoth, Berlin ,Manager
4,bizbiz, bazbaz, Kulalampur, Student
我想用BULK INSERT,具有格式文件。我已經generetade我的格式文件,BCP如下:
C:\Windows\system32>bcp test.dbo.DimensioList format nul -Uuser1 -Puser1 -n
-f "C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\Listfor
mat.fmt"
如果我運行此代碼:
INSERT INTO DimensioList
SELECT *
FROM
OPENROWSET(BULK 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\List.txt', FORMATFILE='C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\Listformat.fmt') as e
我得到這些錯誤:
Msg 4866, Level 16, State 1, Line 2
The bulk load failed. The column is too long in the data file for row 1, column 2. 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)".
順便說一下,我的格式文件是這樣的:
11.0
5
1 SQLINT 0 4 "" 1 EID ""
2 SQLCHAR 2 20 "" 2 Vorname Latin1_General_CI_AS
3 SQLNCHAR 2 40 "" 3 Nachname Latin1_General_CI_AS
4 SQLCHAR 2 20 "" 4 Stadt Latin1_General_CI_AS
5 SQLCHAR 2 20 "" 5 Beruf Latin1_General_CI_AS
你是什麼意思,我該怎麼做才能解決這個問題?
我認爲這是因爲列Vorname在DimensioList表的格式。 「Blabla」似乎對這個專欄來說太大了。 – Polux2