How to convert varchar to date ?

I have one source file which contains the below data
input column: DOB varchar(8)
20000303
20000409
1999043
1999047
validate the Date if valid date else pass the default-1999-12-31,convert varchar to date

Showing Answers 1 - 6 of 6 Answers

sonali

  • Dec 6th, 2014
 

in transformer stage use stringtodate(datecol,format)

  Was this answer useful?  Yes

Sam

  • Dec 17th, 2014
 

Hi, Check for valid date as below:

1.> Len of the string =8 then
Date < sysdate
else default date

2.> We use a) "Iconv" function - Internal Convertion.
b) "Oconv" function - External Convertion.

Function to convert mm/dd/yyyy format to yyyy-dd-mm is
Oconv(Iconv(Filedname,"D/MDY[2,2,4]"),"D-MDY[2,2,4]")

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions