View previous topic :: View next topic |
Author |
Message |
schintala Beginner
Joined: 18 May 2005 Posts: 108 Topics: 31 Location: USA
|
Posted: Wed Jan 25, 2012 12:35 pm Post subject: DB2 Date and Time Concatenation |
|
|
Hi,
I have a table that have two columns to store date and time. Date column defined as Date data type where as Time column defined as CHAR(4). We would like to alter the table for an additional column with TIMESTAMP data type. The data to the new column should be populated from exisitng date and time columns. Is there any way Can I do using SQL to poulate the data into this column.
Table
COL1 DATE
COL2 CHAR(4)
COL3
--
NEWCOL TIMESTAMP. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Jan 25, 2012 1:51 pm Post subject: Re: DB2 Date and Time Concatenation |
|
|
schintala wrote: | Hi,
I have a table that have two columns to store date and time. Date column defined as Date data type where as Time column defined as CHAR(4). We would like to alter the table for an additional column with TIMESTAMP data type. The data to the new column should be populated from exisitng date and time columns. Is there any way Can I do using SQL to poulate the data into this column.
Table
COL1 DATE
COL2 CHAR(4)
COL3
--
NEWCOL TIMESTAMP. |
What is the format of time column? Just HHMM ? If you want the new column to have timestamp is it ok to populate the seconds portion with zeroes in time and the micro seconds with zeroes?
Kolusu |
|
Back to top |
|
 |
schintala Beginner
Joined: 18 May 2005 Posts: 108 Topics: 31 Location: USA
|
Posted: Wed Jan 25, 2012 2:09 pm Post subject: |
|
|
Kolusu,
Thank you so much for the reply. Time stored as HHMM in CHAR(4). Yes. We will store the seconds and microseconds are zeros in new column. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
schintala Beginner
Joined: 18 May 2005 Posts: 108 Topics: 31 Location: USA
|
Posted: Thu Jan 26, 2012 8:33 am Post subject: |
|
|
Thank you so much. It worked. |
|
Back to top |
|
 |
|
|