SSIS Date Format Handling

41 Views Asked by At

I am seeking for suggestions of the date data handling.

I have the following data in the date column from an excel file, it could be string, or date in different format. I wonder what's the best way to import the following data from SSIS to SQL Server?

12/17/2021
17/12/2021
N/A
NA
NULL
20211217
20211712
12-17-2021
17-12-2021

In Excel Source Advanced Editor Setting:
The External Columns: DT_WSTR
The Output Columns: DT8

**Data Type in DB: **
nvarchar 255

With the above variation of the date column, I tried to use the Excel Source Connector to get it done, but it depends of the type of date format/ data combination, sometimes SSIS will let it pass, sometimes it will failed.

**I keep getting a script component error:

The type of the value (Empty) being assigned to variable "User::FileNo" differs from the current variable type (String). Variables may not change type during execution. Variable types are strict, except for variables of type Object.

**Another error from the SSIS log:

Error: 0xC020901C at Data Retrieving From Test, Test Source File [284]: There was an error with Test Source File.Outputs[Excel Source Output].Columns[F1] on Test Source File.Outputs[Excel Source Output]. The column status returned was: "The value could not be converted because of a potential loss of data.". Error: 0xC0209029 at Data Retrieving From Test, Test Source File [284]: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "Test Source File.Outputs[Excel Source Output].Columns[F1]" failed because error code 0xC0209072 occurred, and the error row disposition on "Test Source File.Outputs[Excel Source Output].Columns[F1]" 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. Error: 0xC0047038 at Data Retrieving From Test, SSIS.Pipeline: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on Test Source File returned error code 0xC0209029. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure. Information: 0x40043008 at Data Retrieving From Test, SSIS.Pipeline: Post Execute phase is beginning.

Any thoughts on why this would happen? Many thanks!!

Trying to import different date format data to SQL Server via SSIS.

0

There are 0 best solutions below