2009-09-22 7 views
1

나는 SQL 서버에 일반 텍스트 파일을 가져 오기 위해 SQL Server 가져 오기 마법사를 사용하려고 해요. 이 꽤 간단해야처럼가져 오기 CSV 데이터 - 비밀 오류 메시지

보인다. 텍스트 파일은 탭으로 구분되며 별다른 차이는 없습니다. 나는 마법사의 데이터를 미리 볼 때

은, 모든 확인을 보인다. 열 매핑과 모든 데이터 라인을 확인했는데 데이터 유형은 모두 괜찮은 것처럼 보입니다.

하지만 그것을 실행할 때, 여기에 내가 오류 메시지입니다 :

Copying to [dbo].[my_table] (Error) Messages 

Error 0xc0202009: Data Flow Task: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. 
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Invalid character value for cast specification". 
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Invalid character value for cast specification". 
(SQL Server Import and Export Wizard) 

Error 0xc020901c: Data Flow Task: There was an error with input column "touch4_date" (260) on input "Destination Input" (179). The column status returned was: "The value could not be converted because of a potential loss of data.". 
(SQL Server Import and Export Wizard) 

Error 0xc0209029: Data Flow Task: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "input "Destination Input" (179)" failed because error code 0xC0209077 occurred, and the error row disposition on "input "Destination Input" (179)" 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: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Destination - cm_campaigns" (166) failed with error code 0xC0209029. 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) 

Error 0xc0047021: Data Flow Task: SSIS Error Code DTS_E_THREADFAILED. Thread "WorkThread0" has exited with error code 0xC0209029. There may be error messages posted before this with more information on why the thread has exited. 
(SQL Server Import and Export Wizard) 

일부 추가 세부 사항 ....

플랫 파일은 22 개 행이는. ,

7/2/2008 
8/25/2008 
3/12/2009 

열이 데이터베이스는 날짜입니다 : - 문제 ("touch4_date")의 원인이 될 것 같습니다 열에서

행의 (19)는 빈 값을 포함을, 3은 다음과 같은 값을 포함 null을 허용합니다.

이상한 측면 중 하나는 플랫 파일에 datetime 열에 매핑되는 "mm/dd/yyyy"와 같은 형식의 데이터가있는 다른 열이 포함되어 있지만 오류가없는 것으로 보입니까?

누구든지 문제를 해결할 수 있습니까? 사전에

많은 감사합니다!

답변

1

touch4_date 열은 테이블의 컬럼 형식으로 캐스팅 할 수없는 가치가있다.

+0

데이비드 - 당신의 응답을위한 많은 감사합니다! 해당 열에는 "7/2/2008", "8/25/2008", "3/12/2009"의 세 가지 값만 있습니다. 다른 19 개의 행에는 값이 없습니다. 데이터베이스의 열은 datetime이며 Null을 허용하도록 설정됩니다. 이것이 문제의 원인입니까? IOW -이 형식의 날짜 - "mm/dd/yyyy"는 datetime으로 형변환 될 수 없습니까? – mattstuehler

+0

이 CSV 파일에 헤더가 있습니까? –

+0

... 그리고 매트, 언급 한 빈 행을 제거해보십시오. 그 후에 op가 성공하면이 가져 오기가 왜 작동하지 않는지 적어도 하나의 이유를 알게됩니다. –

0

은 VARCHAR로 열 tough4_date와 준비 테이블에 플랫 파일을 가져보십시오. 실제 테이블에 삽입하고 case 문을 사용하십시오.

declare @string varchar(50) 

set @string='' 



select 
    case @string 
     when '' then null 
     else @string 
    end as String 
관련 문제