How to retrieve current date and time in SQL400

Asked By 20 points N/A Posted on -
qa-featured

How to retrieve current date and time in sql/400 Software/Hardware.

Used: as400 v5r3

SHARE
Answered By 0 points N/A #150098

How to retrieve current date and time in SQL400

qa-featured

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

Related Questions