471,108 Members | 1,239 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,108 software developers and data experts.

locking and rowid

Hello!

1. How can I know exactlly what row is locked? Is data in "resource"
column of sp_lock usable? For example, resource = 03000d8f0ecc

51 14 0 0 DB S
GRANT
51 14 277576027 1 KEY (03000d8f0ecc)
X GRANT
51 14 277576027 1 PAG 1:1112
IX GRANT
51 14 277576027 0 TAB
IX GRANT
51 1 85575343 0 TAB
IS GRANT

2. Is there any equivalent of ORACLE's "rowid" pseudocolumn? How can I
uniquelly identify some row in any given table ( which may not have
primary key defined )?
Jul 20 '05 #1
1 3779
Tenkre (te****@email.t-com.hr) writes:
1. How can I know exactlly what row is locked? Is data in "resource"
column of sp_lock usable? For example, resource = 03000d8f0ecc

51 14 0 0 DB S
GRANT
51 14 277576027 1 KEY (03000d8f0ecc)
X GRANT
51 14 277576027 1 PAG 1:1112
IX GRANT
51 14 277576027 0 TAB
IX GRANT
51 1 85575343 0 TAB
IS GRANT
I cut this explanation about "resource" from Kalen Delaney's "Inside SQL
Server 2000":

A hashed value derived from all the key components and the locator. For a
nonclustered index on a heap, where columns c1 and c2are indexed, the
hash would contain contributions from c1, c2, and the RID

From that to identify the row, appear to be non-trivial.

The data is on page 1:1112, since there is an intent lock on this page.
You could use DBCC PAGE to view this page, to see what rows that could
be on this case. Still far from straightforward.
2. Is there any equivalent of ORACLE's "rowid" pseudocolumn? How can I
uniquelly identify some row in any given table ( which may not have
primary key defined )?


In a relational database, you identify a row through the primary key. And
if there is no primary key, you cannot uniquely identify all rows. And,
no, SQL Server does not expose any internal ids.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by droope | last post: by
2 posts views Thread by captain | last post: by
2 posts views Thread by Scott Holland | last post: by
3 posts views Thread by TP | last post: by
reply views Thread by UJ | last post: by
2 posts views Thread by arivudai2 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.