SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How to get rowid in sql server 2005


How to get rowid in sql server 2005

Author
Message
nitinkumar_tss
nitinkumar_tss
SSC Rookie
SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)

Group: General Forum Members
Points: 27 Visits: 21
I want to get the rowid internally generated at table level in sql server. Because I need to perform some task according to the rowid.
Dan.Humphries
Dan.Humphries
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1165 Visits: 1212
do you want to return a result with a row number as part of the output or do you want to grab a specific row, as in you want row 10 of the data set?

Dan

If only I could snap my figures and have all the correct indexes apear and the buffer clean and.... Start day dream here.
Lynn Pettis
Lynn Pettis
SSC-Forever
SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)

Group: General Forum Members
Points: 40248 Visits: 38567
nitinkumar_tss (3/26/2010)
I want to get the rowid internally generated at table level in sql server. Because I need to perform some task according to the rowid.


Unfortunately, there isn't an internally generated rowid at the table level in SQL Server.

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Garadin
Garadin
SSCrazy
SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)

Group: General Forum Members
Points: 2823 Visits: 4107
It seems like Oracle uses something like this that you can access, but unfortunately MS SQL does not. If you can give more details on your goal, it's possible we can suggest another way to do it.

Seth Phelabaum
Consistency is only a virtue if you're not a screwup. ;-)

Links: How to Post Sample Data :: Running Totals :: Tally Table :: Cross Tabs/Pivots :: String Concatenation
vijay.s
vijay.s
SSC Veteran
SSC Veteran (219 reputation)SSC Veteran (219 reputation)SSC Veteran (219 reputation)SSC Veteran (219 reputation)SSC Veteran (219 reputation)SSC Veteran (219 reputation)SSC Veteran (219 reputation)SSC Veteran (219 reputation)

Group: General Forum Members
Points: 219 Visits: 359
what kind of row id du you need.
If you need row id which is stored in your table then you can use table's identity value for the same
vidya_pande
vidya_pande
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1115 Visits: 242
there is not rowid equivalent in SQL Server



Paul White
Paul White
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16122 Visits: 11355
Lynn Pettis (3/26/2010)
nitinkumar_tss (3/26/2010)
I want to get the rowid internally generated at table level in sql server. Because I need to perform some task according to the rowid.
Unfortunately, there isn't an internally generated rowid at the table level in SQL Server.

Well, technically there is, sort of, but it is undocumented and not intended for use by end users.



Paul White
SQLPerformance.com
SQLblog.com
@SQL_Kiwi
SwePeso
SwePeso
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4137 Visits: 3433
Paul White NZ (3/28/2010)
[quote]Well, technically there is, sort of, but it is undocumented and not intended for use by end users.

+1 for that.
All records do have a "hidden" record identifier, when there is not primary key on the table. That's the way SQL Server distinguishes between two identical records.
Read more about what Kalen Delaney writes about this.


N 56°04'39.16"
E 12°55'05.25"
Lynn Pettis
Lynn Pettis
SSC-Forever
SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)

Group: General Forum Members
Points: 40248 Visits: 38567
SwePeso (3/28/2010)
Paul White NZ (3/28/2010)
[quote]Well, technically there is, sort of, but it is undocumented and not intended for use by end users.

+1 for that.
All records do have a "hidden" record identifier, when there is not primary key on the table. That's the way SQL Server distinguishes between two identical records.
Read more about what Kalen Delaney writes about this.


Is it actually a row identifier, like this is row 10? Reason I ask is that is what most people are looking for when they are asking about an internal rowid. Is that what this individual is asking, not sure.

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
GilaMonster
GilaMonster
SSC Guru
SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)

Group: General Forum Members
Points: 89073 Visits: 45284
Lynn Pettis (3/28/2010)
Is it actually a row identifier, like this is row 10? Reason I ask is that is what most people are looking for when they are asking about an internal rowid. Is that what this individual is asking, not sure.


Think they're talking about the RID. Row Identifier, binary value, 8-byte combination of file id, page number and slot index. It's accessible on all tables (not just heaps), however it's likely to change whenever the clustered index is rebuilt (and, on SQL 2008, if the heap is ever rebuilt) because it's the physical location of the row.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search