0
votes

Trying to import data into SQL table from Excel. One of the columns "RptDt" on Excel file is datetime but sometime it has some string/varchar values "Null" (not Null). OleDestination has column "RptDt" with data type "Dt_date".

I get an error because SSIS takes this "Null" as string when trying to transfer the data to sql.

I'm trying to use derived column but i'm not sure if i have right expression to satisfy dates and string value.

 ISNULL([RptDt] ? (DT_WSTR, 50)("Null") :NULL(DT_DBDATE) : (DT_DBDATE) [RptDt]

Sample column value on RptDt.

08/09/2013

10/09/2013 
Null
NULL

All i'm trying to do is, If column value is string then pass Null value if not pass date.

1
Any thoughts, Please!! - user1810575

1 Answers

0
votes

If you can insert NULL in your table use this derived column code:

 ISNULL([RptDt]) || [RptDt]=="Null" ? NULL(DT_DBDATE) : (DT_DBDATE)[RptDt]