我有一个要使用批量插入命令导入的制表符分隔文件。我有一个格式文件如下。
8.0
9
1 SQLCHAR 0 50 "\t" 1 Field1 "SQL_Latin1_General_CP1_CI_AS"
2 SQLCHAR 0 50 "\t" 2 Field2 "SQL_Latin1_General_CP1_CI_AS"
3 SQLCHAR 0 50 "\t" 3 Field3 "SQL_Latin1_General_CP1_CI_AS"
4 SQLCHAR 0 50 "\t" 4 Field4 "SQL_Latin1_General_CP1_CI_AS"
5 SQLCHAR 0 50 "\t" 5 Field5 "SQL_Latin1_General_CP1_CI_AS"
6 SQLCHAR 0 50 "\t" 6 Field6 "SQL_Latin1_General_CP1_CI_AS"
7 SQLCHAR 0 50 "\t" 7 Field7 "SQL_Latin1_General_CP1_CI_AS"
8 SQLCHAR 0 50 "\t" 8 Field8 "SQL_Latin1_General_CP1_CI_AS"
9 SQLCHAR 0 0 "\r\n" 9 Field9 "SQL_Latin1_General_CP1_CI_AS"
这适用于 ANSI 文件,但是我将文件作为 UCS-2 Little Endian 编码接收。
我试图让这个工作是对格式文件使用以下修改。这停止了任何错误,但我得到了正确数量的所有空列的行数。如果可能,我想避免转换文件。
8.0
9
1 SQLCHAR 0 50 "\t\0" 1 Field1 "SQL_Latin1_General_CP1_CI_AS"
2 SQLCHAR 0 50 "\t\0" 2 Field2 "SQL_Latin1_General_CP1_CI_AS"
3 SQLCHAR 0 50 "\t\0" 3 Field3 "SQL_Latin1_General_CP1_CI_AS"
4 SQLCHAR 0 50 "\t\0" 4 Field4 "SQL_Latin1_General_CP1_CI_AS"
5 SQLCHAR 0 50 "\t\0" 5 Field5 "SQL_Latin1_General_CP1_CI_AS"
6 SQLCHAR 0 50 "\t\0" 6 Field6 "SQL_Latin1_General_CP1_CI_AS"
7 SQLCHAR 0 50 "\t\0" 7 Field7 "SQL_Latin1_General_CP1_CI_AS"
8 SQLCHAR 0 50 "\t\0" 8 Field8 "SQL_Latin1_General_CP1_CI_AS"
9 SQLCHAR 0 0 "\r\0\n\0" 9 Field9 "SQL_Latin1_General_CP1_CI_AS"