used on MS SQL Server to DB2 (v8.2) and have a problem with
the following select statement (snippet) used for a view:
SELECT
col1,
col2,
timestamp-col1,
TO_CHAR(timestamp-col1, 'HH24')
FROM ...
When creating the view that uses this statement, I get the following
error:
SQL0171N The data type, length or value of argument "2" of routine
"SYSIBM.TO_CHAR" is incorrect. SQLSTATE=42815
I tried using 'HH24:MI:SS', but this didn't help. The documentation
on the TO_CHAR() function (and TIMESTAMP_FORMAT) don't show any
examples of a format that doesn't include all timestamp parts (date
and time). However, this column needs to get only the hour portion.
Is there a way to do this in DB2 SQL?
Thanks,
--
Mark Hansen
Sacramento, CA