Detecting Lock on the record . RRS feed

  • Question

  •   if a row has lock(exclusive(x)) Lock then How to detect if a record in databse table has a lock?

     Plz rpl..

    Monday, February 13, 2012 12:59 PM

All replies

  • SSY.DM_TRAN_LOCKS DMV in SQL 2005 and above provides such capabilities.

    Arthur My Blog

    Tuesday, February 14, 2012 3:43 AM
  •   how about sql 2000.? Plz. give me query example for using above(consider i set lock on row having Empname "Jack  Laymen" databse Employee and table personel info) 

    Tuesday, February 14, 2012 4:45 AM
  • In SQL Server 2000 you can use sp_lock or SP_WHO2

    You do not set a lock easily at will, SQL Server manages this for you, and SQL Server 2000 does not have an actual row level locking fully implemented per se

    Arthur My Blog

    Tuesday, February 14, 2012 3:49 PM
  •  ok..plz tell me how to use sp_lock and sp_who2 in sql server2005 and plz give me example to detect if row has lock or not?
    Wednesday, February 15, 2012 4:17 AM
  • It is not very straighforward topic to cover in a short forum reply, but I have found several excellent links for you:

    http://www.mssqltips.com/sqlservertip/1359/locking-and-blocking-scripts-in-sql-server-2000-vs-sql-server-2005/ and


    Arthur My Blog

    Wednesday, February 15, 2012 3:44 PM