In a db2
database I have a DATE
column and a TIME
column, how can you combine these into a single TIMESTAMP
?
Asked
Active
Viewed 3.2k times
2 Answers
34
The timestamp
function can be called with two arguments, one of which is date and one of which is time:
select timestamp(date_col,time_col) from your_table
-
1Fantastic, that is super handy :) – xan Mar 01 '13 at 11:26
2
As per this thread, the [TIMESTAMP][2]
function can accept 2 parameters, so you can simply pass it the DATE
and TIME
components and it constructs the TIMESTAMP
for you.
SELECT MyDate,
MyTime,
TIMESTAMP(MyDate, MyTime) AS MyTimestamp
FROM MyTable

xan
- 7,440
- 8
- 43
- 65