Current Timestamp in to 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
cosec
Premium Member
Premium Member
Posts: 230
Joined: Tue May 08, 2007 8:10 pm

Current Timestamp in to DB2

Post by cosec »

I am trying to insert the Current Time Stamp in to a target Column.

when I have the target as a Sequential File My OutPut for that column is of the form :15:07:29 18 MAY 2007


But When My Target is a DB2 Table My Out Put is :

0015-11-27 17:26:43.694000

Any suggestions to correct this ?
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

Easy way is to use is "CURRENT TIMESTAMP" in your insert SQL statement.
Last edited by JoshGeorge on Fri May 18, 2007 6:52 am, edited 1 time in total.
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The DB2 stage wants dates in internal format, from what I recall.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

How are you getting the Current Timestamp? What is the length of your target stage?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
cosec
Premium Member
Premium Member
Posts: 230
Joined: Tue May 08, 2007 8:10 pm

Post by cosec »

Target Length is 26.

I am using TimeDate() in one of the transformer columns....Do u think I should convert it to internal and then reconvert it ???
chulett wrote:The DB2 stage wants dates in internal format, from what I recall. ...
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Well, DB2 accepts date in internal format, I am sure about that. Not too sure about timestamp though.
Try

Code: Select all

OCONV(Date(), "D-YMD[4,2,2]"):" ":OCONV(Time(), "MTS")
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
rafik2k
Participant
Posts: 182
Joined: Wed Nov 23, 2005 1:36 am
Location: Sydney

Post by rafik2k »

I am using following format to generate current db2 timestamp in my jobs.
you can try

Code: Select all

oconv(@Date,"D-YMD[4,2,2]"):" ":Oconv(@TIME,"MTS")

Result = 2007-05-21 15:21:00
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Same thing :wink:
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
rafik2k
Participant
Posts: 182
Joined: Wed Nov 23, 2005 1:36 am
Location: Sydney

Post by rafik2k »

First try to insert one dummy row with timestamp value '2007-05-21 15:21:00' into target db2 table, and see what output you get.

If it's ok then you can try following code.

rafik2k wrote:I am using following format to generate current db2 timestamp in my jobs.
you can try

Code: Select all

oconv(@Date,"D-YMD[4,2,2]"):" ":Oconv(@TIME,"MTS")

Result = 2007-05-21 15:21:00
rafik2k
Participant
Posts: 182
Joined: Wed Nov 23, 2005 1:36 am
Location: Sydney

Post by rafik2k »

DSguru2B wrote:Same thing :wink:
DS Guru Ji,
You need zoom lens to check that :lol:
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Then I will be seeing micro-organisms within the internal dates. :wink:
Why I said its the same thing is because both @Date and Date() return internal formats. Same is the case with @Time and Time().
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply