0

我正在尝试导入 txt 文件并正在使用导入方法到 SQL Server 中,并且很难将字符串转换为datetime格式,因为 SQL Server 中的列之一是datetime格式。它给出了 2 类错误。请建议,我应该在导入方法中将格式转换为其他格式还是尝试使用新表

这是sql server表的数据类型的格式

[int     NOT NULL,
 [varchar   (32) NULL,
 [int    NULL,
 [int    NULL,
 [varchar   (512) NULL,
 [int    NULL,
 [float  NULL,
 [float  NULL,
 [int    NULL,
 [float  NULL,
 [int    NULL,
 [float  NULL,
 [float  NULL,
 [datetime   NULL,
 [int    NULL,
 [datetime   NULL,
 [int    NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [int    NULL,
 [int    NULL,
 [int    NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [datetime   NULL,
 [datetime   NULL,
 [float  NULL,
 [datetime   NULL,
 [datetime   NULL,
 [int    NULL,
 [int    NULL,
 [float  NULL,
 [float  NULL,
 [int    NULL,
 [float  NULL,
 [int    NULL,
 [bit    NULL,
 [bit    NULL,
 [bit    NULL,
 [varchar   (256) NULL,
 [datetime   NULL,
 [float  NULL,
 [float  NULL,
 [datetime   NULL,
 [datetime   NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [datetime   NULL,
 [float  NULL,
 [int    NULL,
 [int    NULL,
 [int    NULL,
 [int    NULL,
 [int    NULL,
 [int    NULL,
 [datetime   NULL,
 [datetime   NULL,
 [datetime   NULL,
 [int    NULL,
 [int    NULL,
 [int    NULL,
 [datetime   NULL,
 [int    NULL,
 [float  NULL,
 [int    NULL,
 [int    NULL,
 [datetime   NULL,
 [datetime   NULL,
 [datetime   NULL,
 [datetime   NULL,
 [datetime   NULL,
 [datetime   NULL,
 [datetime   NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [datetime   NULL,
 [datetime   NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [datetime   NULL,
 [datetime   NULL,
 [float  NULL,
 [int    NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [datetime   NULL,
 [float  NULL,
 [int    NULL,
 [int    NULL,
 [varchar   (256) NULL,
 [varchar   (256) NULL,
 [float  NULL,
 [varchar   (16) NULL,
 [float  NULL,
 [varchar   (128) NULL,
 [int    NULL,
 [bit    NULL,
 [bit    NULL,
 [int    NULL,
 [varchar   (64) NULL,
 [int    NULL,
 [varchar   (64) NULL,
 [float  NULL,
 [datetime   NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [datetime   NULL,
 [int    NULL,
 [varchar   (16) NULL,
 [char  (1) NULL,
 [char  (1) NULL,
 [varchar   (16) NULL,
 [datetime   NULL,
 [char  (1) NULL,
 [float  NULL,
 [datetime   NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [datetime   NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [bit    NULL,
 [datetime   NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [datetime   NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [varchar   (128) NULL,
 [bit    NULL,
 [datetime   NULL,
 [int    NULL,
 [datetime   NULL,
 [varchar   (64) NULL,
 [float  NULL,
 [varchar   (64) NULL,
 [varchar   (512) NULL,
 [varchar   (128) NULL,
 [varchar   (128) NULL,
 [varchar   (32) NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [int    NULL,
 [varchar   (128) NULL,
 [varchar   (128) NULL,
 [int    NULL,
 [int    NULL,
 [float  NULL,
 [datetime   NULL,
 [float  NULL,
 [int    NULL,
 [bit    NULL,
 [datetime   NULL,
 [varchar   (512) NULL,
 [int    NULL,
 [int    NULL,
 [int    NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [float  NULL,
 [int    NULL,
 [int    NULL,
 [int    NULL,
 [int    NULL,
 [int    NULL,
 [int    NULL,
 [int    NULL,
 [datetime   NULL,
 [int    NULL,
 [datetime   NULL

5590    AACMT 2005-C6A  503 56  MMC Borrower LLC, Marsh USA Borrower LLC, Seabury & Smith Borrower LLC, Mercer HR Consulting Borrower LLC and Mercer MC Consulting Borrower LLC 15  0.05701 0.056896    2   475000000   361 475000000   359000000   20050929    360 20351011    2   430026303.9 359000000   0.69    398 398 0   1   1   1.36    1.44        0.731   0.66        0.069227    0.058535    0.058535        45014186    9512000 20110101    20110331    650000000   20051101    20051029    360 360 0.05701 0.000114    1   0.0001  1   N   N   N   YM@25b(284) 20120213        0.05701         2036013     0                                                                               0               20051101    20051101    20100101    20101231    1   26392357        38048000    1.44    1.44    38048000    38048000            1   26392357        38048000    1.44    1.44    38048000    38048000    20110101    20110331    1   6598090     9512000 1.44    1.44    9512000 9512000 20351011        429312084       1   1166 Avenue of the Americas (Marsh)     H           0   N   Y   27935   AACMT 2005-C6   1   343001412   430026304   20120211        0.05701 0.056896    2042983 714220  2757203                         3               CMSA        N                                                   475000000                                                       1166 Avenue of the Americas (Marsh) N                           Marsh & McLennan Companies, Inc.                                    Wells Fargo Bank    Wells Fargo Bank    77  1   650000000   20051101    20351011    0   N       L(24), YM@25b(336)          0       1.441629        1.36    0.11129         284                 38048000    20101231    38048000    20101231
4

1 回答 1

0

请建议,我应该在导入方法中将格式转换为其他格式还是尝试使用新表

我的建议是将其作为 varchar 导入,然后使用 SQL 中的数据将其转换为正确的格式。然后通过导入程序,您将更容易找出转换错误的来源。

于 2013-06-02T02:29:40.447 回答