conversion from string 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

gauravrb
Participant
Posts: 28
Joined: Wed Dec 27, 2006 11:31 pm
Location: Mumbai

conversion from string to timestamp

Post by gauravrb »

Hi,

What might be the possible reason for the warning

"Conversion error calling conversion routine timestamp_from_string data may have been lost"

I am trying to convert the string "yyyy-mm-dd 00:00:00" in timestamp format.

what might be the possible solution for avoiding the warning?
Gaurav.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Post your syntax.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Post your source timestamps - they may have fractional seconds.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
gauravrb
Participant
Posts: 28
Joined: Wed Dec 27, 2006 11:31 pm
Location: Mumbai

Post by gauravrb »

in source there is date string "yyyy-mm-dd" to which iam concatination hard coded "00:00:00" and then converting it into timestamp.
Gaurav.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Try appending " 00:00:00" (note the leading space character).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
gauravrb
Participant
Posts: 28
Joined: Wed Dec 27, 2006 11:31 pm
Location: Mumbai

Post by gauravrb »

Tried appending " 00:00:00" with leading space also but still the same warning.
Gaurav.
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »

Do you get this warning when trying to load a database? If so, which database are you trying to load? Also, when you declared the field as timestamp, what were the length and scale defined as?

Whale.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
gauravrb
Participant
Posts: 28
Joined: Wed Dec 27, 2006 11:31 pm
Location: Mumbai

Post by gauravrb »

I am trying to load the data into data set. The length of timestamp field i have kept 25 nothing else.
Gaurav.
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »

Try 19.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Hi,
What is the syntax that you have mentioned in Modify stage?
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
gauravrb
Participant
Posts: 28
Joined: Wed Dec 27, 2006 11:31 pm
Location: Mumbai

Post by gauravrb »

svcon=TrimF(TrimB(DecimalToString(DSLink3.MSBDAY,"suppress_zero")))

var5=If Len(svconv)=6 Then 19:svconv Else If Len(svconv)=7 Then 20:Right(svconv,6) Else "0"

If var5<>"0" Then StringToTimestamp(var5[1,4]:"-":var5[5,2]:"-":var5[7,2] : " 00:00:00","%yyyy-%mm-%dd %hh:%nn:%ss") Else "0"
Gaurav.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I guess I should have a thicker skin than this, but how in the heck does my simple request for you to 'post your syntax' deserve a rating of '0: Off-topic / Superfluous'? :evil:

Look where we are now, you posting exactly that after someone else requested it. And it would have reveal that you were manually adding the 'time' portion to the timestamp, something you failed to mention in your original post.
-craig

"You can never have too many knives" -- Logan Nine Fingers
gauravrb
Participant
Posts: 28
Joined: Wed Dec 27, 2006 11:31 pm
Location: Mumbai

Post by gauravrb »

my sincere apology for that chulett, i missed your post. Yes iam appending the time part manually but do think that is the reason for which it is giving warning beacuse the same warning is given when i convert string to date.
Gaurav.
BigFoot
Participant
Posts: 5
Joined: Mon Jan 08, 2007 2:55 am
Location: Bangalore

Post by BigFoot »

hi gourab,

try this out...

TimestampToDateTime("your date field",StringToTime("00:00:00"))

The one which are in Bold are the datastage functions.
Vinay
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Gaurav wants to use Modify stage. Those functions are Transformer stage functions.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply