SSIS Date conversion from number


hi trying use ssis convert  and import data input text file sql server database .

it giving error  date field.

the input data date      90407     , out put should  2007-09-04 . ( or mm/dd/yyyy) .it can null too. mote input  data sample:101112  or  50613

how convert it? use data conversion task  with data type dt_date.did not work .

i think need use derived  column.not sure should expression,because input 7 , 8 chars long. 

i error  the conversion returned status value 2 , status text "the value not converted because of potential loss of data."

 error: data conversion failed while converting column "startdt" (46) column "copy of startdate"

thanks,

jay





you can convert string first in derived column transformation , use data conversion.  or can conversion directly in derived column.  here code generate string work standard date.

"20" + right( (dt_str, 6, 1252) column, 2) + "-"  + left(right("0" + (dt_str, 6, 1252) column, 6), 2) + "-"  + substring(right("0" + (dt_str, 6, 1252) column, 6), 3,2)
(dt_date) ( "20" + right( (dt_str, 6, 1252) column, 2) + "-"  + left(right("0" + (dt_str, 6, 1252) column, 6), 2) + "-"  + substring(right("0" + (dt_str, 6, 1252) column, 6), 3,2) )



russel loski, mct, mcse data platform/business intelligence. twitter: @sqlmovers; blog: www.sqlmovers.com



SQL Server  >  SQL Server Integration Services



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........