Page 1 of 1

Need function in datastage to convert string datatype todate

Posted: Wed Jul 18, 2007 11:24 pm
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

Posted: Wed Jul 18, 2007 11:33 pm
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.

Re: Need function in datastage to convert string datatype to

Posted: Thu Jul 19, 2007 4:57 am
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.

Re: Need function in datastage to convert string datatype to

Posted: Thu Jul 19, 2007 5:00 am
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

Re: Need function in datastage to convert string datatype to

Posted: Thu Jul 19, 2007 6:59 am
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.