从具有额外值的文件中批量插入

BULK INSERT from file which has extra values

如何告诉格式文件应忽略 csv 文件中的列。我尝试输入 0,但出现无效列号错误:

Format file: 

10.0
9
0      SQLCHAR             0       12      "\t"     1     ID                   ""
2      SQLCHAR             0       10      "\t"     2     Symbol               SQL_Latin1_General_CP1_CI_AS
0      SQLCHAR             0       11      "\t"     3     DateDone             ""
0      SQLCHAR             0       19      "\t"     4     TimeDone             ""
4      SQLCHAR             0       10      "\t"     5     Side                 SQL_Latin1_General_CP1_CI_AS
5      SQLCHAR             0       12      "\t"     6     Size                 ""
6      SQLCHAR             0       41      "\t"     7     Price                ""
7      SQLCHAR             0       10      "\t"     8     Exchange             SQL_Latin1_General_CP1_CI_AS
8      SQLCHAR             0       12      "\r\n"   9     Position             ""

csv 数据的示例行

------------------------------------------------------------------------------------------------------------------------
|AccountName || ExecSymbol ||   ExecDateTime || ExecSide    || ExecSize || ExecPrice    || ExecExchange || PositionSize|
 ------        ------------  ----------------  ------------  -----------   ----------      -------------   -------------
    PRIMU$    ||   SCO      ||    1/2/2013    ||   B         ||  100     ||  38.87       ||   ARCA       ||   100

最简单的方法是创建一个 'fmt' 文件,该文件可以指定要导入的内容和要忽略的内容:

https://msdn.microsoft.com/en-us/library/ms179250.aspx