Loading Time in 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
shyam_etl
Premium Member
Premium Member
Posts: 8
Joined: Mon Aug 22, 2005 3:34 am

Loading Time in DB2

Post by shyam_etl »

Hi all,

I have an issue loading Time into a DB2 table field ( sql type 'Time' length 8 ).

When i use Oconv(@time, "MTS"), the database wouldnt accept the return value identifing it as a string.

To my utter surprise,The same derivation Oconv(@time, "MTS") for a Timestamp field ( length 26) returns the Timestamp in 'YYYY-MM-DD HH:MI:SS.XXXXXX' where X represent the micro seconds.

But if the job gets aborted for watever reasons, the status for the timestamp field in the log is only the time in hh:mi:ss format ( not the whole timestamp)

Does this mean, the same return value of a function, would be interpreted diffently by fields having different datatypes?


Could someone help me how to handle Time in DB2,


Cheers,
Shyam
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

A search of the forum will reveal that the DB2 stage expects DataStage internal format. Try @TIME by itself.

Otherwise, use the current time constant in DB2 SQL.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
shyam_etl
Premium Member
Premium Member
Posts: 8
Joined: Mon Aug 22, 2005 3:34 am

Post by shyam_etl »

ray.wurlod wrote:A search of the forum will reveal that the DB2 stage expects DataStage internal format. Try @TIME by itself.

Otherwise, use the current time constant in DB2 SQL.

I forgot to mention that am using ODBC stage instead of DB2 stage. The datastage internal '@time' function wouldnt work.

Could you brief more on using the current time constant in DB2 SQL?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In each database there are constants for current date and current time. Their names vary. I don't have the DB2 ones in my head. Names like SYSDATE or CURRENT_TIME are the kind of thing I have in mind. But I don't have enough (unpaid) time to research them for you.
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