如何跳过格式文件中的表列

时间:2013-09-13 05:46:21

标签: sql-server sql-server-2008 bcp

我不想要输出文件中的最后一列数据。所以,我试图跳过格式文件中的最后一列(ID_CARD)。但是我没有得到正确的输出。只是想确认它是正确的方法吗?

跳过之前

68      SQLCHAR             0       3       ""       68    PBP_ID                       Latin1_General_BIN

69      SQLCHAR             0       25      ""       69    PREVENTIVE_SERVICES          Latin1_General_BIN

70      SQLCHAR             0       216     ""       70    FILLER4                      Latin1_General_BIN

71      SQLCHAR             0       11      "\r\n"   71    ID_CARD_NO                   Latin1_General_BIN

试图跳过:

68      SQLCHAR             0       3       ""       68    PBP_ID                       Latin1_General_BIN

69      SQLCHAR             0       25      ""       69    PREVENTIVE_SERVICES          Latin1_General_BIN

70      SQLCHAR             0       216     ""       70    FILLER4                      Latin1_General_BIN

71      SQLCHAR             0       0      ""        0        ID_CARD_NO                   Latin1_General_BIN

1 个答案:

答案 0 :(得分:0)

根据this中的指定,有两种方法可以跳过列:

第一种方法是设置"前缀长度," "主机文件数据长度,"和"服务器列顺序"到0

68      SQLCHAR             0       3       ""       68    PBP_ID                       Latin1_General_BIN

69      SQLCHAR             0       25      ""       69    PREVENTIVE_SERVICES          Latin1_General_BIN

70      SQLCHAR             0       216     ""       70    FILLER4                      Latin1_General_BIN

71      SQLCHAR             0       0      ""        0        ID_CARD_NO                   Latin1_General_BIN

你已经尝试过,第二个是删除整行:

9.0
70
....

68      SQLCHAR             0       3       ""       68    PBP_ID                       Latin1_General_BIN

69      SQLCHAR             0       25      ""       69    PREVENTIVE_SERVICES          Latin1_General_BIN

70      SQLCHAR             0       216     ""       71    FILLER4                      Latin1_General_BIN

请注意,在这种情况下,您必须减少总数。要导入的行,即71将在标题中变为70,但在server column order,即最后一列,它将保留列顺序即。 71