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!

Find internal Row index of a Table? 2

Status
Not open for further replies.

huckfinn19

Programmer
May 16, 2003
90
CA
Hi!

I am using SQL server and am trying to find the internal row indexes of a table. For example, with the following table

Client:

ClientID | ClientName
---------------------
cid01 | name01
cid02 | name02

I would like to be able to get the internal row ID of this structure meaning that I'd like to be able to do something like:
Code:
SELECT system.RowID FROM Client;
giving me something like:

system.RowID
0
1

Note that "system.RowID" is from my imagination. I would like to find if it exists in some way. If it does, I would then be able to do something like:
Code:
SELECT ClientID, ClientName FROM Client WHERE system.RowID = 1;

giving me:
ClientID | ClientName
---------------------
cid02 | name02

Is this possible with SQL Server? I think it is with Oracle, but can't find the feature in SQL Server... This would be very helpful to do some virtual browsing by allowing to get the items from let's say, 0 to 50, but also then from 50 to 100...

Thanks!

Huck

 
I don't believe there is "bookmark" feature in SQL Server, but there is a fairly easy way to leaf through the dataset if you have a column which has unique values. You setup a loop that takes the Top 50 rows Where the column>Last starting row. It's not a single query, but the new version, Yukon, should be able to utilize a better approach.
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top