Discussion:
trunc_timestamp function
(too old to reply)
s***@yahoo.com
2007-08-06 07:06:33 UTC
Permalink
Hi all,
I have sql that requires the function trunc_timestamp. I am using db2 v7.1 on a windows platform.(I still use this version coz our client uses the same).This function is not in v7, is it possible to create it(so that its user defined), and does anyone have the function's code? Or is there way around this other than upgrading to v9.
Thank you in advance.
Knut Stolze
2007-08-06 15:09:37 UTC
Permalink
Post by s***@yahoo.com
Hi all,
I have sql that requires the function trunc_timestamp. I am using db2 v7.1
on a windows platform.(I still use this version coz our client uses the
same).This function is not in v7, is it possible to create it(so that its
user defined), and does anyone have the function's code? Or is there way
around this other than upgrading to v9. Thank you in advance.
What is this function doing? DB2 doesn't have that.

If it is just truncating the string representation of a timestamp, you could
do something like this:

SUBSTR(CAST(<timestamp> AS VARCHAR), 1, ...)

You can then wrap this SQL expression in a UDF named TRUNC_TIMESTAMP.
--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Loading...