Hi,
I have a text file source which has column 'BirthDate'. The values are in the format 10Feb1987. It has NULL values also.
I have to load this values into a Table -column 'BirthDate' and its datatype is DateTime.
I need to convert 10Feb1987 to 1987-02-10 and load the data. If the value is NULL, it has to be NULL (not any default date value).
I used the below expression in SSIS derived column expression - It is working fine if it has values. But it is not working if it has NULL value.
(DT_DBDATE)(((DT_WSTR,2)((SUBSTRING(Birthdate,3,3) == "JAN") ? "01" : (SUBSTRING(Birthdate,3,3) == "FEB") ? "02" : (SUBSTRING(Birthdate,3,3) == "MAR") ? "03" : (SUBSTRING(Birthdate,3,3) == "APR")
? "04" : (SUBSTRING(Birthdate,3,3) == "MAY") ? "05" : (SUBSTRING(Birthdate,3,3) == "JUN") ? "06" : (SUBSTRING(Birthdate,3,3) == "JUL") ? "07" : (SUBSTRING(Birthdate,3,3) == "AUG")
? "08" : (SUBSTRING(Birthdate,3,3) == "SEP") ? "09" : (SUBSTRING(Birthdate,3,3) == "OCT") ? "10" : (SUBSTRING(Birthdate,3,3) == "NOV") ? "11" : (SUBSTRING(Birthdate,3,3) == "DEC")
? "12" : "00")) + "-" + (DT_WSTR,2)(SUBSTRING(Birthdate,1,2)) + "-" + ((DT_WSTR,4)(SUBSTRING(Birthdate,6,4))))
Can you please help me on how to deal with NULL values in the expression?
Thanks in advance!