PS
drop the square brackets - AS400 does not like them.
Main Topics
Browse All TopicsHi all, I have a quick question about the syntax for an SQL statement I am writing. I need to know how to do an UPDATE statement such as:
UPDATE U269672.MYFILE SET [Date Created] = .....(a value that an AS/400 file recognizes as a date).....WHERE.....(rest of code I know).....
Does anyone know the syntax? I know that you use the '#' characters in Access, but that doesn't seem to work on the pass-through query I am writing for the AS/400 SQL.
Thanks in Advance,
Greg
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hey, thanks for the help but no go. Ok let me give you an update and maybe a more specific error.
This is a pass-through query in Access using a DSN connection to the AS/400. It is an update query (I have update rights, I know) but when I tried the suggested method of inserting the date into the file on the AS/400, I got an error. Something to the effect of syntax of date, timestamp not valid. I am pretty sure I did it the way you suggested.
Do you have any other ideas? How about maybe a system command I can run to see the available methods I have for the Query Manager SQL? Or a good reference to try. I bet like you said since each AS/400 is different, maybe my command varies, although with this one it wouldn't seem logical. Thanks for the reply in advance.
Greg
http://publib.boulder.ibm.
BTW, are you sure that the column is of type DATE?
As the date type was not supported in RPGIII, there are many applications and software packages where days are represented by numeric fields. In fact, too many die hard AS400 programmers do not use DATE columns at all.
Can you debug your program and post here the actual SQL string that is passed through to the AS400 system?
Actual SQL:
UPDATE OSDALL SET SHORT = 0, OVER = 1, MISROUTE = 1, DBLLABEL = 0, DUPLABEL = 0, NOLABEL = 0, SENTVIA = 0, CORRECTPL = 1, SALTED = 0, REVSALT = 0, RTRNTOSTK = 0, SCNDLPN = '', CONTACTNM = '', COMMENTS = '', PICKUPDT = '', OSDCODE = '', ARRIVALDT = DATE('20030529'), DCR = DATE('20030529') WHERE DVCASEN = '00000841650645966286'
Error Message:
[DB2/400 SQL]SQL0180 Syntax of date, time, or timestamp value not valid. (#-180)
Thanks again,
Greg
Business Accounts
Answer for Membership
by: shalomcPosted on 2003-06-06 at 05:49:36ID: 8665669
I assume that the "Date Created" column is of type DATE, isn't it?
DB2 SQL support the DATE function to convert various formats to a date value.
The most obvious one is DATE( 'yyyy-mm-dd' ) which will conver a character string to a date.
A caveat is the fact that the delimiter ('-' in my example) may change between different systems, it may be '/' on your AS400.
I suggest the following syntax:
date( timestamp ( 'yyyymmdd000000' ) )
that is independent of any date format and delimiter definition and should work for any DB2.
to convert June 13rd,2003 we would write date( timestamp ( '20030613000000' ) )