我知道這個問題可能會重複。但是,我得到的問題與此不同。我已經創建了沒有數據的表「CRM_Doctor_Budget」。在sql server 2008中導入excel文件
我想從excel文件該表中插入數據。
我正在使用導入和導出數據(32位)。
接着步驟我做的:
錯誤,我越來越:
- Validating (Error)
Messages
Error 0xc0202049: Data Flow Task 1: Failure inserting into the read-only column "Id".
(SQL Server Import and Export Wizard)
Error 0xc0202045: Data Flow Task 1: Column metadata validation failed.
(SQL Server Import and Export Wizard)
Error 0xc004706b: Data Flow Task 1: "component "Destination - CRM_Doctor_Budget" (59)" failed validation and returned validation status "VS_ISBROKEN".
(SQL Server Import and Export Wizard)
Error 0xc004700c: Data Flow Task 1: One or more component failed validation.
(SQL Server Import and Export Wizard)
Error 0xc0024107: Data Flow Task 1: There were errors during task validation.
(SQL Server Import and Export Wizard)
我在轉換VARCHAR,INT,SMALLINT位數據類型收到錯誤。因爲excel文件具有所有數據的通用數據類型。在我已經創建的表中,我有varchar,int,float,smallint和bit。
檢查後,「啓用標識插入」我得到更少的錯誤,但錯誤如下:
Copying to [dbo].[CRM_Doctor_Budget] (Error)
Messages
Error 0xc0202009: Data Flow Task 1: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "Unspecified error".
(SQL Server Import and Export Wizard)
Error 0xc020901c: Data Flow Task 1: There was an error with input column "Id" (143) on input "Destination Input" (72). The column status returned was: "The value violated the integrity constraints for the column.".
(SQL Server Import and Export Wizard)
Error 0xc0209029: Data Flow Task 1: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "input "Destination Input" (72)" failed because error code 0xC020907D occurred, and the error row disposition on "input "Destination Input" (72)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
(SQL Server Import and Export Wizard)
Error 0xc0047022: Data Flow Task 1: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Destination - CRM_Doctor_Budget" (59) failed with error code 0xC0209029 while processing input "Destination Input" (72). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.
(SQL Server Import and Export Wizard)
您是否嘗試將其保存爲csv文件,然後使用tsql批量插入?語法很簡單。批量插入[表名]從[filepath.csv]與(ROWTERMINATOR =「\ n」,FIELDTERMINATOR =「」)只需砍列標題出CSV文件的。 – 2013-03-06 15:46:10