Sort of...

SELECT IDENTITY(int,1,1) as ID_Num, [name], Age
INTO #tempTbl
FROM myTable

SELECT * FROM #tempTbl

That's the only way afaik...  #tempTbl will be built automatically.  No need
to declare it or create it.



-----Original Message-----
From: Jochem van Dieten [mailto:[EMAIL PROTECTED]] 
Sent: Monday, February 03, 2003 3:06 PM
To: CF-Talk
Subject: Re: OT: (cross post) SQL row numbering


Matthew Small wrote:
> How can I get SQL server to automatically number my rows of a 
> recordset, as I retrieve it?
> 
> If I have the following information in a table (example data)
> 
> Name    Age
> Joe       20
> Sally     14
> Jim       15
> 
> And I do a query:
> 
> Select somefunction() as rownum, name, age from table

Doesn't SQL server support sequences? In that case somefunction would be 
<next value expression>.

Jochem


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to