Current Timestamp in to DB2
Moderators: chulett, rschirm, roy
Current Timestamp in to DB2
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 ?
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 ?
-
- Participant
- Posts: 612
- Joined: Thu May 03, 2007 4:59 am
- Location: Melbourne
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>
<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>
Well, DB2 accepts date in internal format, I am sure about that. Not too sure about timestamp though.
Try
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.
I am using following format to generate current db2 timestamp in my jobs.
you can try
Result = 2007-05-21 15:21:00
you can try
Code: Select all
oconv(@Date,"D-YMD[4,2,2]"):" ":Oconv(@TIME,"MTS")
Result = 2007-05-21 15:21:00
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.
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