How to retrieve current date and time in SQL400

There are three ways to retrieve the current date and time in SQL server. First is through CURRENT_TIMESTAMP, GETDATE() & {fn NOW()}.
If you run the following script in Query Analyzer this will give you the same results. If you see execution plan there is no performance difference. It is the same for all the three selected statement.
SELECT CURRENT_TIMESTAMP
GO
SELECT {fn NOW()}
GO
SELECT GETDATE()
GO
or you can make use of this…
SELECT CURDATE() FROM SYSIBM/SYSDUMMY1
SELECT CURDATE() FROM SYSIBM.SYSDUMMY1
In interactive SQL – F13
last item on page is Naming convention *SYS/*SQL
*SYS support " / " *SQL support (dot) " . "
SELECT CURTIME() FROM SYSIBM/SYSDUMMY1
SELECT NOW() FROM SYSIBM/SYSDUMMY1 – for both date and time…
Hope this helps.
Jen
Notifications