3 useful query to check DB lock and how to kill the lock:
A. Sample query to check open transactions, very useful if you feel any open transactions on the table(lock) and have not committed:
select * from master..sysprocesses where open_tran > 0

B. Sample query to check the query cause the lock, replace the #spid# from the result you get from step #A:
dbcc inputbuffer(#spid#)

C. Sample query to kill a process in SQL server, [spid] is the spid you get from #A:
Kill [spid]

keep-calm-and-lock-the-database-2

Advertisements