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

Can you create an Auto Number using a queries result?

Status
Not open for further replies.

Crauck

Programmer
Jul 26, 2002
24
US
I would like to know if you can create an Auto Number field using a queries result.

For example if I have a query using a table and changed the sort order, I would like to have {Since you can't select on record Numbers} a field that Numbers the rows in the queries result 1 through whatever.
 
There are of course ways using a programming language to post-process the recordset returned by a query and attach numbers but I don't thing its possible with SQL alone (having said that I'm sure someone will immediately prove me wrong.)

As I see it, the basic problem is that you don't know the order to assign the numbers until the "ORDER BY" clause has done its thing. That's not until after you have generated the records BUT it is in the record generation process that you would have to assign the record numbers.

This site does however have thousands of people who are smarter than me so you may still get an answer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top