How to retrieve current date and time in SQL/400

Tags:
SQL/400
How can I retrieve current date and time in SQL/400?


Software/Hardware used:
as400 v5r3
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

i got the perfect answer…

<b>SELECT CURDATE() FROM SYSIBM/SYSDUMMY1

SELECT CURDATE() FROM SYSIBM.SYSDUMMY1</b>

In inteactive SQL – F13
last item on page is Naming convention *SYS/*SQL
*SYS support ” / ” *SQL support (dot) ” . ”

<b>SELECT CURTIME() FROM SYSIBM/SYSDUMMY1

SELECT NOW() FROM SYSIBM/SYSDUMMY1 </b> – for both date and time…

thanks Mr. Phil and Tom

Discuss This Question: 11  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • TomLiotta
    In addition to CURRENT TIMESTAMP (or CURRENT_TIMESTAMP), there is also CURRENT DATE and CURRENT TIME. There are also the CURDATE() and CURTIME() scalar functions. A quick scan of the SQL Reference shows all of these. Look through the lists of functions and look through the list of reserved words in the manual for finding words related to what you're interested in. Tom
    125,585 pointsBadges:
    report
  • The Most-Watched IT Questions: January 18, 2012 - ITKE Community Blog
    [...] 4. TomLiotta and CharlieBrown explained how to retrieve the current date and time in SQL400. [...]
    0 pointsBadges:
    report
  • pdsathishkumar
    i don't know how to use the keywords.. please share me query for get current date and time in SQL400..
    3,805 pointsBadges:
    report
  • TomLiotta
    please share me query for get current date and time in SQL400.. That's not quite what this forum is for. That's what the manuals are for. Look at the CURDATE function in the SQL Reference for an example. This forum would be used if the function did not seem to work as it was documented. This can't be used as a training site because it would get flooded with thousands of questions that can be found simply by looking at the reference manuals. We could never have time to help with actual problems. Tom
    125,585 pointsBadges:
    report
  • pdsathishkumar
    I got the answer from SQL reference book... that query is SELECT CURDATE() FROM SYSIBM.SYSDUMMY1 but it is not working. it ll show the error "Qualified object name SYSDUMMY1 not valid" if you have any solution, share me
    3,805 pointsBadges:
    report
  • philpl1jb
    Standard qualification in sql uses period .. default on AS/400 uses / SYSIBM.SYSDUMMY1 vs SYSIBM/SYSDUMMY1 In inteactive SQL - F13 last item on page is Naming convention *SYS/*SQL *SYS is / *SQL is . Phil
    54,090 pointsBadges:
    report
  • TomLiotta
    “Qualified object name SYSDUMMY1 not valid” The help text for that message includes this:
    • With system naming, the qualified form of an object name is schema-name/object-name. With SQL naming the qualified form of an object name is authorization-name.object-name.
    A qualified name such as "sysibm.sysdummy1" can take two possible formats. The delimiter is a .dot (".") in standard SQL format. It is a forward-slash ("/") in system naming format. You choose which format to use when you start the client. On most systems, the STRSQL command uses system naming format as its default. You can change that by specifying the NAMING() parameter when you run the command. You can also change it by pressing <F13=Services> on the SQL command display and taking option 1, Change session attributes. Other clients, such as the iSeries Navigator 'Run SQL Scripts' function, will usually default to SQL naming. Depending on which client you use and what settings you choose, the statement will either work correctly or will show the error that you saw. Your settings are up to you. Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    “Qualified object name was easy to find in the same SQL Reference manual.
    54,090 pointsBadges:
    report
  • Jai1234567
    select curdate() from SYSIBM.SYSDUMMY1
    10 pointsBadges:
    report
  • Saipavanp

    Hi Michael,

    Could you please tell me, How to kbow last implementation date in AS400.


    BR,

    Sai

    10 pointsBadges:
    report
  • ToddN2000
    @Saipavanp: First off Mike no longer manages the site so if you do not get a response it doen not mean he's ignoring you.  What do you mean by implementation date? Are you referring to an actual AS/400 which has not been sold in many years. They newer machines have newer names. According to the Wiki page..

    The platform was first introduced as the AS/400 (Application System/400) in June 1988 and later renamed to the eServer iSeries in 2000. As part of IBM's re-branding initiative in 2006, it was again renamed to System i. The codename of the AS/400 project was "Silver Lake", named for the lake in downtown Rochester, Minnesota, where development of the system took place.

    In April 2008, IBM announced its integration with the System p platform. The unified product line is called IBM Power Systems and features support for the IBM i (previously known as i5/OS or OS/400), AIX and GNU/Linux operating systems.
    136,290 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: