Click here to monitor SSC
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
Forum Newbie
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: General Forum Members
Points: 9 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
SSC Eights!
SSC Eights! (825 reputation)SSC Eights! (825 reputation)SSC Eights! (825 reputation)SSC Eights! (825 reputation)SSC Eights! (825 reputation)SSC Eights! (825 reputation)SSC Eights! (825 reputation)SSC Eights! (825 reputation)

Group: General Forum Members
Points: 825 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-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24217 Visits: 37978
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
SSCommitted
SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)

Group: General Forum Members
Points: 1523 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-Enthusiastic
SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)

Group: General Forum Members
Points: 127 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
SSC Eights!
SSC Eights! (891 reputation)SSC Eights! (891 reputation)SSC Eights! (891 reputation)SSC Eights! (891 reputation)SSC Eights! (891 reputation)SSC Eights! (891 reputation)SSC Eights! (891 reputation)SSC Eights! (891 reputation)

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



Paul White
Paul White
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10338 Visits: 11350
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
SSCrazy
SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)

Group: General Forum Members
Points: 2469 Visits: 3431
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-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24217 Visits: 37978
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-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47283 Visits: 44392
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