sqlagent007
asked on
SSIS 2016 how can I use the derived column or data conversion to convert a string value of "3/1/2017" to SMALLDATETIME?
I thought this would be easy and I am able to do this with ease in TSQL, but I am struggling in SSIS. I have a flat file (.txt) that has a column named [DATE], this column puts the start_date and end_date together like this: "03/01/2017 - 04/01/2017". I am able to perform the conversion I need with a simple CAST in TSQL like this:
I have tried using the [derived column] and [data conversion] in SSIS with no luck. I keep getting this error when trying to insert into the OLE DB destination: "The value could not be converted because of a potential loss of data".
Please help experts....
declare @test varchar (50) ='03/02/2017 - 04/01/2017'
select cast(left(@test,10) as smalldatetime) as Date_Start
select cast(right(@test,10) as smalldatetime) as Date_End
I have tried using the [derived column] and [data conversion] in SSIS with no luck. I keep getting this error when trying to insert into the OLE DB destination: "The value could not be converted because of a potential loss of data".
Please help experts....
ASKER
Thanks @Pawan, I will be testing this later today.
ASKER
I keep getting this error:
Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "Derived Column" failed because error code 0xC0049064
can you show exactly what you are doing?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks!
create a derived column and use
Date_Start -> (DT_DBTIMESTAMP)(left(@tes
create a derived column and use
Date_end -> (DT_DBTIMESTAMP)(right(@te