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

using "rownum" in Oracle...

Status
Not open for further replies.

tjn

IS-IT--Management
May 20, 2001
1
SE
I have been using Oracle for years and have some queries that utilize "rownum" in retrieving a row counter for each record in the result set. Does SQL Server have a similar capability?
Any and all help is much appreciated.
Thanks in advance!
Tom
sql:
select rownum,first_name from people;
result set:
ROWNUM FIRST_NAME
------ ----------------------
1 Alice
2 Rachel
3 Bob
4 Nick
 
You don't really have that in SQL Server. The closest thing is @@CURSOR_ROWS which will reveal how many rows are in the cursor. Obviously, you could select an additional dummy column, then add code to scroll through and assign &quot;record numbers&quot; to each row, but I doubt its worth the trouble for you. [sig]<p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br> [/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top