Timestamp and DB2

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
asitagrawal
Premium Member
Premium Member
Posts: 273
Joined: Wed Oct 18, 2006 12:20 pm
Location: Porto

Timestamp and DB2

Post by asitagrawal »

I am writing the timestamp (YYYY-DD-MM HH:MI:SS.SSSSSS) into a DB2 tables, from a job.
The data when written to a seq file, is written with the microseconds., but when the same is written into a DB2 table, the microseconds change to '000000'.
How do I handle the issue.???
Krazykoolrohit
Charter Member
Charter Member
Posts: 560
Joined: Wed Jul 13, 2005 5:36 am
Location: Ohio

Post by Krazykoolrohit »

can you post an exapmle?
asitagrawal
Premium Member
Premium Member
Posts: 273
Joined: Wed Oct 18, 2006 12:20 pm
Location: Porto

Post by asitagrawal »

Krazykoolrohit wrote:can you post an exapmle?
INSERT INTO FDM1PA.PS_ASCDTTM (JOB,ASC_DTTM) VALUES (?,?);
Krazykoolrohit
Charter Member
Charter Member
Posts: 560
Joined: Wed Jul 13, 2005 5:36 am
Location: Ohio

Post by Krazykoolrohit »

I meant, the data examples. Like the input data which you have. what format its in seq file and what format its in DB2 table.
asitagrawal
Premium Member
Premium Member
Posts: 273
Joined: Wed Oct 18, 2006 12:20 pm
Location: Porto

Post by asitagrawal »

Input = '2006-10-23 17:15:58.135789'
Output (SEQ File) = '2006-10-23 17:15:58.135789'
Output (Db2) = '2006-10-23 17:15:58.000000'
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

What if you insert something thats on the higher end in the nanoseconds category. Something like
'2006-10-23 17:15:58.835789'
Does that get rounded off too
'2006-10-23 17:15:59.000000' :?:

What if you specify the sql type as varchar, do you still encounter the same problem?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
asitagrawal
Premium Member
Premium Member
Posts: 273
Joined: Wed Oct 18, 2006 12:20 pm
Location: Porto

Post by asitagrawal »

Yes...it is getting stored as 000000 only for microseconds...no rounding off to next highr sec is taking place......and also VarChar did not help...
DeepakCorning
Premium Member
Premium Member
Posts: 503
Joined: Wed Jun 29, 2005 8:14 am

Post by DeepakCorning »

ASC_DTTM -- What is the type of the field in the DB ?? Date , DateTime , Timestamp?? Also Can you Populate a SEQUENTIAL file again in addition with the DB2 Table and let us know what is getting stored in that one? This will help us to find out that it is happening during the job or while inserting.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Are you providing any sort of transformations?
I have worked with DB2. If you dont insert the nano seconds part, only then the database will add .000000 to it. If you are passing it, then it gets inserted as it is. If nothing else worked, varchar should have worked. There is something else going on. Are you doing any iconv/oconv of type MTS?
Did you try inserting a record with nano seconds from command line? does that work?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
asitagrawal
Premium Member
Premium Member
Posts: 273
Joined: Wed Oct 18, 2006 12:20 pm
Location: Porto

Post by asitagrawal »

The datatype is TImestamp.
I have verified, populating, a Seq File, that the nano seconds are coming properly....
Also, am not using any othe Trans (Iconv or Oconv)...
I ahve also tried inserting from Command Line...it is going abs fine...
but the prob is coming from Ascential to DB2.....

Even tried by hard coding a vakue like. 2006-12-12 12:15:16.123456..
nut it is going like 2006-12-12 12:15:16.000000!
bmarko22
Participant
Posts: 21
Joined: Mon Nov 16, 2009 7:03 am
Location: MD

Post by bmarko22 »

Are you setting microseconds on table definition of source and target? Also, you say you are looking for (YYYY-DD-MM HH:MI:SS.SSSSSS) I was able to get timestamp with milliseconds by having it converted to %yyyy-%mm-%dd %hh:%nn:%ss.6 in the format.
Post Reply