Sql-server – How to see SQL 2008 Locks and Blocked Tables


During the ASP.NET execution of my app, it seems SQL 2008 Express holds some lock, and I get

Timeout expired.  The timeout period elapsed prior to completion of

the operation or the server is not

Maybe some of my query is not optimized. Visual Studio crashes with:

Microsoft Visual Studio may be unstable now. It is recommended that

you save all files and exit.

I need to see what query is blocking my tables, but I have the Express version. How can I do?


Best Solution

You can query against the sys.dm_tran_locks dynamic view to obtain this information. Go here on MSDN to lean more.