convert varchar to timestamp

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
times29
Premium Member
Premium Member
Posts: 202
Joined: Mon Sep 22, 2008 3:47 pm

convert varchar to timestamp

Post by times29 »

Hi,
I have column year datatype varchar which goes in to column date datatype timestamp and i am getting errors how can i convert varchar to timestamp keeping the same format

so

Code: Select all

Source (Varchar)                   Target(timestamp)
2004                               2004
2005                               2005
I am using transformer for conversation
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You don't have a timestamp in your data. You have merely a year.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chandra.shekhar@tcs.com
Premium Member
Premium Member
Posts: 353
Joined: Mon Jan 17, 2011 5:03 am
Location: Mumbai, India

Post by chandra.shekhar@tcs.com »

@times29
Just a bit of thinking will show you that just a year part cannot be stored in to a timestamp. You have to have a month, date and time along with the year. So either you have to hardcode a value into those places(month, date and time) or dynamically generate it, may be for example use a CurrentTimestamp() function.
Thanx and Regards,
ETL User
Post Reply