jeudi 14 juillet 2016

How to find what is locking my tables

I have a SQL table that all of a sudden cannot return data unless I include "with (nolock)" on the end, which indicates some kind of lock left on my table. I've experimented a bit with dm_tran_locks to identify that there are in fact a number of locks on the table, but how do I identify what is locking them (ie the request element of the dm_tran_locks)?

EDIT: I know about sp_lock for pre SQL 2005, but now that that sp is deprecated, AFAIK the right way to do this is with dm_tran_locks. I'm using SQL Server 2008 R2.

Aucun commentaire:

Enregistrer un commentaire