Click to See Complete Forum and Search --> : MSSQL Rowlock


asubra
July 15th, 2003, 02:40 AM
hi there,
i need some guidance on the MSSQL Rowlock.
I'm using the command

set transaction isolation level serializable
BEGIN TRAN
select statement...


COMMIT TRAN // when want to release the lock

Prob:
The above statements will lock the records that are accessed using select statement above,
if another person accessing the same record, MSSQL won't allow to lock the record but can be accessed using select statement as usual.
But the problem is, how do i check whether that record is locked or not ?

because when an application locks that rows, others can't access the same rows. Is there any SQL statements that can be used to check whether that records are locked or not ?

TQVM

vonarxma
July 21st, 2003, 07:25 AM
Hi,

Look at the lockingtable (for details please refer to the sqlserver documentation)...

...there is another point: I guess the sqlserver is locking i/o-pages and not rows (or you can lock the whole table)

vonarxma
July 21st, 2003, 07:43 AM
ups, I'm wrong, sorry

sqlserver v7.0 (and above) can lock rows...

for viewing locks u can use the system stored procedure sp_lock (recommended)

there is an enhanced version of this stored procedure: sp_lock2 (see http://support.microsoft.com/support/kb/articles/Q255/5/96.ASP)