Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL insert question

Status
Not open for further replies.

TracyV

Programmer
Nov 24, 2003
35
US
Could anyone tell me how to change the SQL below to populate by relative record number or the arrival sequence in ASCOMM? The file does not have a sequence number in which to sort the order the comments were added, so arrival sequence would work for what I need. Thanks!


C/Exec SQL
C+ Insert into QTEMP/ASCOMM
C+ Select * from MDNASDEV/ASCOMM
C+ Where CCEN = :Century and
C+ CYR = :Year and
C+ CHOUSE = :House# and
C+ CSPLTC = :parmSplit
C/End-Exec
 
As long as there are no deleted records in the file and it does not get reorganized with RGZPFM, they will be in arrival sequence (I'm assuming the file is not keyed).

You might consider adding a timestamp to the file and sort that way.

Feles mala! Cur cista non uteris? Stramentum novum in ea posui!

 
C/Exec SQL
C+ Insert into QTEMP/ASCOMM
C+ Select * from MDNASDEV/ASCOMM
C+ Where CCEN = :Century and
C+ CYR = :Year and
C+ CHOUSE = :House# and
C+ CSPLTC = :parmSplit
C+ Order By RRN(ASCOMM)
C/End-Exec

I had to add the order by RRN to get the results I was looking for.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top