Page 1 of 1

How to convert varchar to Date

Posted: Mon Jun 23, 2008 8:09 pm
by Jagan617
I am getting varchar from source and i need to convert it to date? Can anyone assist me

Posted: Mon Jun 23, 2008 8:27 pm
by chulett
Use the Oconv/IConv functions. Would need specific examples to provide specific help or you could search the forums for "OConv" for examples already discussed.

Re: How to convert varchar to Date

Posted: Mon Jun 23, 2008 8:37 pm
by sreddy
1)Flat file ---- RDBMS stage(oracle,DB2 etc)
source=20080505target=iconv(source,'DYMD[4,2,2]') TARGET META DATA SHOULD BE DATEIF LEN(SOURCE)<8 THEN ICONV(SOURCE,'DYMD[2,2,2]')
ELSE IF LEN(SOURCE)=8 THEN iconv(source,'DYMD[4,2,2]')
ELSE IF
ELSE IF
ELSE
2)FLAT FILE FLAT FILE2008-06-06
OCONV(OCONV(SOURCE,'D-YMD[4,2,2]'),'D/YMD[4,2,2]')2008/06/06
2)FLAT FILE ORACLE2008-06-06
ICONV(OCONV(SOURCE,'D-YMD[4,2,2]'),'D/YMD[4,2,2]')2008/06/06 JULIAN DATE
ICONV(JULAINDATE,'DYMD')\ IF DATE IS NULL THEN @NULL
ELSE ICONV(DATE,"DYMD") IF ISNULL(TRIM(NAME)) THEN @NULL
ELSE SUBSTRINGS(NAME,1,10)










Jagan617 wrote:I am getting varchar from source and i need to convert it to date? Can anyone assist me

Posted: Tue Jun 24, 2008 1:17 am
by ray.wurlod
What does the incoming value look like?