I am working with some tricky data, and am trying to join a timestamp to a date while getting rid of the timestamp all together and just keeping the date. I have tried a few different methods, but this is the most recent:
convert(row_add_ts, convert(date, current_timestamp)) as Row_add_ts
this is what the data looks like currently:
2017-01-01 00:00:08
this is how I want it to look:
2017-01-01
The join that I currently have looks like:
Left outer join Table 2 b
on a.row_adds_ts = b.Table_date
I keep getting different errors, but the most recent is:
[Code: -206, SQL State: 42703] DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=DATE, DRIVER=4.19.49. 2) [Code: -514, SQL State: 26501] DB2 SQL Error: SQLCODE=-514, SQLSTATE=26501, SQLERRMC=SQL_CURLH200C1, DRIVER=4.19.49
It looks like it is failing to convert the timestamp data type over to a date data type. I'm not sure how to proceed from here.
I have also tried:
left(cast(row_adds_ts as date), 10)
to no prevail.
So it looks like the below query worked to give me what I was looking for:
Date(row_add_ts)