Need function in datastage to convert string datatype todate

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
nilesh
Participant
Posts: 17
Joined: Tue Aug 08, 2006 5:02 am
Location: Mumbai

Need function in datastage to convert string datatype todate

Post by nilesh »

Hi,

My requirement is like this.I have one column whoes data type is varchar and data is like 4/17/2002 00:00:00

I am mapping this column with my target column whoes data type is date.

Can anybody tell me the funciton to convert it into date format.

I need to retain all the 18 characters of the original column.

Thanks in advance,
Nilesh
Nilesh Malekar
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Depends on your target what 'date format' means. And depending on how trustworthy your data was, you could just use substring to get that into date format or combine that with IConv/OConv if there were any doubts.

Check out your online help for the IConv/OConv functions using the 'D' and 'MT' conversion codes. Substring is the square brackets '[]' or the Field function can be used as well.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sachin1
Participant
Posts: 325
Joined: Wed May 30, 2007 7:42 am
Location: india

Re: Need function in datastage to convert string datatype to

Post by sachin1 »

hello, if your target column is for database then you need to use database specific date formating like to_date(), otherwise just check for proper length for that date column.
baglasumit21
Participant
Posts: 132
Joined: Wed Mar 01, 2006 11:12 pm
Location: Pune

Re: Need function in datastage to convert string datatype to

Post by baglasumit21 »

Its your call. you can use the Iconv function or also use the substring function in the derivation of the output link.

nilesh wrote:Hi,

My requirement is like this.I have one column whoes data type is varchar and data is like 4/17/2002 00:00:00

I am mapping this column with my target column whoes data type is date.

Can anybody tell me the funciton to convert it into date format.

I need to retain all the 18 characters of the original column.

Thanks in advance,
Nilesh
SMB
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Need function in datastage to convert string datatype to

Post by chulett »

sachin1 wrote:hello, if your target column is for database then you need to use database specific date formating like to_date(), otherwise just check for proper length for that date column.
First get it into the 'proper' format then let the SQL generate with the correctly masked version of TO_DATE(), whatever the equivalent is in your database - that's specific to Oracle as far as I know.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply