TIMESTAMP TO INTEGER

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
sush26283
Participant
Posts: 68
Joined: Thu May 20, 2010 11:55 am

TIMESTAMP TO INTEGER

Post by sush26283 »

Hi,

I have a job where, I am using a column say Px_A (source) which is in TIMESTAMP to use it for a column at target say ZX_B which is in integer and I need to get there only the YEAR from the source column PX_A.
Can anyone please guide me how I can achieve that.

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

Post by chulett »

What is your source, a database? If so, which one? Regardless, it should be as simple as getting the year from the timestamp, which could be just a substring of the first four characters.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sush26283
Participant
Posts: 68
Joined: Thu May 20, 2010 11:55 am

Post by sush26283 »

both source and target are SQL SERVER
sush26283
Participant
Posts: 68
Joined: Thu May 20, 2010 11:55 am

Post by sush26283 »

I was initially using link.column [1,4] in the transformer for the derivation of the column but, its giving error that non numeric character present where numeric expected..
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What does a timestamp look like after you extract it from SQL Server? Meaning, what format is it in? That will drive where you'll substring the year from.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sush26283
Participant
Posts: 68
Joined: Thu May 20, 2010 11:55 am

Post by sush26283 »

its in yyyymmdd : hr:mm:ss
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

If that was true then your [1,4] substring should have worked. Change your target to a flat file, include the timestamp and show us what you get.
-craig

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