How to convert varchar to Date

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Jagan617
Participant
Posts: 42
Joined: Thu Jun 05, 2008 7:37 pm

How to convert varchar to Date

Post by Jagan617 »

I am getting varchar from source and i need to convert it to date? Can anyone assist me
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sreddy
Participant
Posts: 144
Joined: Sun Oct 21, 2007 9:13 am

Re: How to convert varchar to Date

Post 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
SReddy
dwpractices@gmail.com
Analyzing Performance
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What does the incoming value look like?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply