Extra characters at the end of a datetime or interval

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
Das
Participant
Posts: 87
Joined: Tue Oct 24, 2006 9:58 pm
Location: india

Extra characters at the end of a datetime or interval

Post by Das »

I am getting the following message in Datastage Director "Extra characters at the end of a datetime or interval".

Incoming date format is: 2000-09-07 09:26:27.000 ,i want to convert it to 2000-09-07 09:26:27 for comparing the date field with the date field in the table. Please provide a solution
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Code: Select all

Left(TheTimestamp, 19) 
or

Code: Select all

Field(TheTimestamp, ".", 1, 1)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Also, try to change both formats using ICONV and then do the comparison, IMHO. I am not a big fan of date string comparisons.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I'm a big fan of efficiency and ease of maintenance.

All that's required is to lose the milliseconds from a timestamp.

Iconv() and Oconv() don't work with timestamps, so that you'd need to do some string manipulation in any case.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

What type of database are you dealing with? What is the length of timestamp there? If it supports milliseconds, then i would say keep your milliseconds in tact if your going for a string comparison.
In the end, 2000-09-07 09:26:27.000 is different than
2000-09-07 09:26:27.003 :wink:
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Das
Participant
Posts: 87
Joined: Tue Oct 24, 2006 9:58 pm
Location: india

Post by Das »

ray.wurlod wrote:

Code: Select all

Left(TheTimestamp, 19) 
or

Code: Select all

Field(TheTimestamp, ".", 1, 1)
...
Hi Ray,
Thanks.

This is working fine.But i dont know why 000 is appended at the end of the time stamp ,As it is declared timestamp 19 in source and target and bith are same table.

[/b]
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 »

What IS the database that you are dealing with? Is it SQL Server?

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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It's not DataStage that's appending the "000" - it's your SELECT statement. Try it in a different client.
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