string to timestamp

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
satya99
Participant
Posts: 104
Joined: Thu Nov 30, 2006 1:22 pm

string to timestamp

Post by satya99 »

How to convert string value to timestamp

ex: string value(yyyymmdd) 20080709

Thanks
satya
sachin1
Participant
Posts: 325
Joined: Wed May 30, 2007 7:42 am
Location: india

Re: string to timestamp

Post by sachin1 »

if you are inserting the value in database with column of sql type as timestamp then you need a format as 'YYYY-MM-DD HH24:MI:SS', do concatenation to get this format with proper time you want.

inputstring[1,4]:'-': inputstring[5,2]:'-':inputstring[7,2]:' ':'00:00:00'
satya99
Participant
Posts: 104
Joined: Thu Nov 30, 2006 1:22 pm

Re: string to timestamp

Post by satya99 »

I am getting warning messages

test..Sort: At row 1, link "DSLinkxx", while processing column "DT"
Value treated as NULL
Attempt to convert String value "20080709" to Timestamp type unsuccessful

Input souce column datatype is varchar
sachin1 wrote:if you are inserting the value in database with column of sql type as timestamp then you need a format as 'YYYY-MM-DD HH24:MI:SS', do concatenation to get this format with proper time you want.

inputstring[1,4]:'-': inputstring[5,2]:'-':inputstring[7,2]:' ':'00:00:00'
satya
sachin1
Participant
Posts: 325
Joined: Wed May 30, 2007 7:42 am
Location: india

Re: string to timestamp

Post by sachin1 »

your formatting is wrong i think please can you check my previous post
satya99
Participant
Posts: 104
Joined: Thu Nov 30, 2006 1:22 pm

Re: string to timestamp

Post by satya99 »

every thing looks good, i created a test column to check the output leaving the original one, the warning is regarding the original column.

Thanks sachin
sachin1 wrote:your formatting is wrong i think please can you check my previous post
satya
Post Reply