1
我寫這篇文章的批量插入格式文件:
批量插入格式文件錯誤
8.0
7
1 SQLCHAR 1 9 " " 1 f1 SQL_Latin1_General_CP1_CI_AS
2 SQLCHAR 1 5 " " 2 f2 SQL_Latin1_General_CP1_CI_AS
3 SQLCHAR 1 12 " " 3 f3 SQL_Latin1_General_CP1_CI_AS
4 SQLCHAR 1 10 " " 4 f4 SQL_Latin1_General_CP1_CI_AS
5 SQLCHAR 1 8 " " 5 f5 SQL_Latin1_General_CP1_CI_AS
6 SQLCHAR 1 5 " " 6 f6 SQL_Latin1_General_CP1_CI_AS
7 SQLCHAR 1 5 "\n" 7 f7 SQL_Latin1_General_CP1_CI_AS
和我的文件中的數據是:
43266200 6827 43295200 1393/05/23 14:26:26 18 1
43266200 6819 43295200 1393/05/23 14:28:45 113 1
但是當我運行此查詢:
bulk insert goy
from 'd:\test.txt'
with(
formatfile='d:\format.fmt'
);
sql服務器錯誤是:
Msg 4862, Level 16, State 1, Line 1
Cannot bulk load because the file "d:\format.fmt" is incomplete or could not be read. Operating system error code (null).
我該如何解決這個問題?
檢查這個答案 - http://stackoverflow.com/a/8270755/1080354 – gotqn 2014-11-02 09:53:41
你的數據顯示七列,但你的格式文件只定義六。這可能意味着「文件」d:\ format.fmt「不完整」 – 2014-11-02 12:00:43