我正在尝试将一些数据从文本文件导入到我的数据库中的表中。但是我收到以下错误:“C:\ Temp \ PetSales.fmt无法读取。操作系统错误代码(null)”这是什么意思?我想知道是因为我为目标列添加了0,我不想导入到我的表中(第3,5,6列)?
我的以下SQL语句:
BULK INSERT Sales
FROM 'C:\Temp\P1.txt'
WITH
(FORMATFILE = 'C:\Temp\PetSales.FMT')
格式文件:
10.0
14
1 SQLDATETIME 0 0 "," 3 Date SQL_Latin1_General_CP1_CI_AS
2 SQLDATETIME 0 0 "," 4 Time SQL_Latin1_General_CP1_CI_AS
3 SQLCHAR 0 0 "," 0 Pet SQL_Latin1_General_CP1_CI_AS
4 SQLCHAR 0 0 "," 1 order SQL_Latin1_General_CP1_CI_AS
5 SQLCHAR 0 0 "," 0 Pet SQL_Latin1_General_CP1_CI_AS
6 SQLCHAR 0 0 "," 0 Pet SQL_Latin1_General_CP1_CI_AS
7 SQLCHAR 0 0 "," 5 Desc SQL_Latin1_General_CP1_CI_AS
8 SQLCHAR 0 0 "," 6 Tele SQL_Latin1_General_CP1_CI_AS
9 SQLCHAR 0 0 "," 7 Mob SQL_Latin1_General_CP1_CI_AS
10 SQLCHAR 0 0 "," 8 Customer SQL_Latin1_General_CP1_CI_AS
11 SQLCHAR 0 0 "," 9 Address 1 SQL_Latin1_General_CP1_CI_AS
12 SQLCHAR 0 0 "," 10 Address 2 SQL_Latin1_General_CP1_CI_AS
13 SQLCHAR 0 0 "," 11 Address 3 SQL_Latin1_General_CP1_CI_AS
14 SQLCHAR 0 0 "\r\n" 12 Address 4 SQL_Latin1_General_CP1_CI_AS
答案 0 :(得分:2)
在行尾添加一个返回