
Some DB2 for OS/400 SQL syntax questions
An ISV who is MS SQL Server expert posted some questions to me for help.
They R developing SQL for one of my AS/400 customer. Here R the
questions:
1) AS/400 cannot handle this:
UPDATE A Set A.Zone = B.Zone From F_Accnts A, F_Area B Where A.Area =
B.Area
They used this instead but found it very slow:
UPDATE F_Accnts Set F_Accnts.Zone = (Select F_Area.Zone from F_Area
where F_Area.Area_ID = F_Accnts.Area_ID)
Any suggestion on how to improve the run-time performance other than
using Visual Explain to analyse it ?
2) AS/400 cannot handle this:
Select * from F_Accnts where right(ID_Type,2) = '19'
Can SUBSTRING provide equivalent result ? Does it work with VARCHAR
field ?
3) AS/400 cannot handle this:
Create View Test as Select * from zTime1 Union Select * from zTime2
What can be an equivalent statement that AS/400 supports ?
4) AS/400's Date data type only support the year from 1940 to 2039. I
suggest to use TIMESTAMP instead because it run from year 1900 to 9999.
Is this a proper suggestion ?
5) How can AS/400 provide an equivalent of the following date
manipulation funtions of MS SQL:
Select DatePart(mm,Date_Tx1) from Test and
Select Date_Tx1 - 10 from Test
I thank U in advance for any help.
================================================
Satid S.
IBM Thailand