批量导入0行受影响

时间:2013-07-18 11:46:19

标签: sql-server-2008 import bulkinsert bcp

在SQL Server 2008中使用批量插入命令时,它返回:

(0 row(s) affected)

我正在使用此命令执行批量插入:

BULK INSERT Test
    FROM 'C:\DataFiles\Tests.dat'
    WITH (FORMATFILE = 'C:\DataFiles\FormatFiles\TestFormat.Fmt');
GO

Tests.dat包含:

b00d23fe-580e-42dc-abd4-e8a054395126,48dd5dd6e3a144f7a817f234dd51469c,452eb8ce-6ae2-4e7a-a389-1097882c83ab,,, ,,,,Aria,,,160,,,86400,,2004-04-03 23:23:00.000,,2012-07-06 13:26:31.633,2012-07-06 13:27:44.650,3,,,,51B7A831-4731-4E2E-ACEC-06636ADC7AD3,,0,,0,,Field Name 1,,Field Name 2,,Field Name 3,,Field Name 4,

格式文件TestFormat.fmt包含:

9.0
39
1       SQLCHAR       0       37      ","      1     Key                                              ""
2       SQLCHAR       0       37      ","      2     TestType                                         ""
3       SQLCHAR       0       37      ","      3     CaseKey                                          ""
4       SQLCHAR       0       30      ","      4     Height                                           ""
5       SQLCHAR       0       30      ","      5     Weight                                           ""
6       SQLCHAR       0       128     ","      6     PacemakerType                                    Latin1_General_CI_AI
7       SQLCHAR       0       0       ","      7     Diary                                            Latin1_General_CI_AI
8       SQLCHAR       0       0       ","      8     Indication                                       Latin1_General_CI_AI
9       SQLCHAR       0       0       ","      9     Medication                                       Latin1_General_CI_AI
10      SQLCHAR       0       37      ","      10    RecorderType                                     ""
11      SQLCHAR       0       100     ","      11    RecorderSerial                                   Latin1_General_CI_AI
12      SQLCHAR       0       0       ","      12    Comments                                         Latin1_General_CI_AI
13      SQLCHAR       0       12      ","      13    Status                                           ""
14      SQLCHAR       0       0       ","      14    AdditionalData                                   Latin1_General_CI_AI
15      SQLCHAR       0       37      ","      15    OrderKey                                         ""
16      SQLCHAR       0       12      ","      16    Duration                                         ""
17      SQLCHAR       0       12      ","      17    Age                                              ""
18      SQLCHAR       0       24      ","      18    RecordingStartDateTime                           ""
19      SQLCHAR       0       128     ","      19    Ward                                             Latin1_General_CI_AI
20      SQLCHAR       0       24      ","      20    CreatedDateTime                                  ""
21      SQLCHAR       0       24      ","      21    UpdatedDateTime                                  ""
22      SQLCHAR       0       21      ","      22    UserGroupBits                                    ""
23      SQLCHAR       0       24      ","      23    LastArchive                                      ""
24      SQLCHAR       0       128     ","      24    PointOfCare                                      Latin1_General_CI_AI
25      SQLCHAR       0       128     ","      25    Bed                                              Latin1_General_CI_AI
26      SQLCHAR       0       37      ","      26    DownloadFacilityKey                              ""
27      SQLCHAR       0       37      ","      27    AnalysisFacilityKey                              ""
28      SQLCHAR       0       12      ","      28    Priority                                         ""
29      SQLCHAR       0       37      ","      29    FacilityKey                                      ""
30      SQLCHAR       0       12      ","      30    PacemakerTypeStandard                            ""
31      SQLCHAR       0       128     ","      31    TestTypeName                                     Latin1_General_CI_AI
32      SQLCHAR       0       128     ","      32    UserDefined1Name                                 Latin1_General_CI_AI
33      SQLCHAR       0       128     ","      33    UserDefined1Value                                Latin1_General_CI_AI
34      SQLCHAR       0       128     ","      34    UserDefined2Name                                 Latin1_General_CI_AI
35      SQLCHAR       0       128     ","      35    UserDefined2Value                                Latin1_General_CI_AI
36      SQLCHAR       0       128     ","      36    UserDefined3Name                                 Latin1_General_CI_AI
37      SQLCHAR       0       128     ","      37    UserDefined3Value                                Latin1_General_CI_AI
38      SQLCHAR       0       128     ","      38    UserDefined4Name                                 Latin1_General_CI_AI
39      SQLCHAR       0       128     "\r\n"   39    UserDefined4Value                                Latin1_General_CI_AI

我无法弄清楚为什么这不起作用。其他人也有类似的问题,因为他们的数据库中有更多字段和实际列。或者使用明显不受支持的.csv文件。

这对我导入的数据库中的每个其他表都没有错误,所以我无法理解为什么它在这里不起作用。

任何帮助将不胜感激! 感谢

0 个答案:

没有答案