how to retrieve current date and time in SQL400

3790 pts.
Tags:
SQL/400
how to retrieve current date and time in sql/400


Software/Hardware used:
as400 v5r3

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: 8  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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • 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
  • pdsathishkumar
    [...] 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,790 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,790 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
    50,860 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.
    50,860 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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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

Following