2013-05-31 186 views
0

我正在嘗試導入txt文件,並且正在使用導入方法導入到SQL Server中,並且由於SQL Server中的其中一列的格式爲datetime格式,因此我很難將字符串轉換爲datetime格式。它給出了類型2錯誤。請指點,我應該去轉換中導入方法其他格式到的東西,或者我應該嘗試使用新表SQL Server 2012:導入錯誤

這是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 [email protected](284) 20120213  0.05701   2036013  0                    0    20051101 20051101 20100101 201.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), [email protected](336)   0  1.441629  1.36 0.11129   284     38048000 201
+0

請添加標籤,指明您正在使用的SQL Server版本。 2005年,2008年,2012年? – DOK

+0

**顯示我們的一些代碼**和您正在導入的文件樣本!另外:你用什麼來導入文件? C#代碼?集成服務?還有別的嗎? –

+0

好的 - 謝謝你的表結構 - 但我們確實需要看到你正在嘗試導入**文件**和**代碼**進行導入,瞭解可能會出錯的.... –

回答

0

的數據類型的格式,請建議,我應該去轉換導入方法中的格式轉換成別的東西 或者我應該嘗試使用新表

我的建議是將其導入爲VARCHAR,然後用數據在SQL工作,將其轉換爲p羅珀格式。您將可以更輕鬆地整理轉換錯誤來自進口商的位置。