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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can SQL give sequential numbers to its output lines?

Status
Not open for further replies.

VickyWass

Programmer
Apr 23, 2001
1
GB
Using SQL in Access 2, I want my query to output a field saying '1' against the first line of the resultset, '2' against the next line, etc. Is this something autoincrement does, and if so, how do you write it into the query? I can't work it out from the help files.
 
I think the only way to get this to work is to run two queries. The first one to create a table with an autoincrement in and the second to fill all fields bar the autoincrement from your whatever (Use an append query). I assume you are creating a table? Peter Meachem
peter@accuflight.com
 
My question would be why? Typically queries are not used for display purposes but as recordsources for forms or reports(or other queries). You can easly assign row numbers in a report using the running sum property of an unbound control whose controlsource is set to =1.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top