16

In a db2 database I have a DATE column and a TIME column, how can you combine these into a single TIMESTAMP?

xan
  • 7,440
  • 8
  • 43
  • 65

2 Answers2

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
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