Lock and Connection Management

Technical Article

Show Blocking and Wait time

  • Script

When executed against a database in which blocking occur, below script will report lockType, Object waited for and current Wait times. The script requires access to master..systables. The script queries syslockInfo (as does sp_lock), but further joins sysprocesses with an interpretation of waitresource matching SQL Server 7.0 and SQL Server 2000.

You rated this post out of 5. Change rating


2,559 reads

Technical Article

Report Locking on Specific Database

  • Script

This Script reports locking on a particular database either to the console or to a database table. It also allows filtering based on a minimum locking level (say Page or Table and higher). Included is the CREATE TABLE statement to build the reporting table. This table can reside in any database but needs to be […]

You rated this post out of 5. Change rating


1,007 reads

Technical Article

sp_dba_checkblocked fix for sp_NotifyBlock

  • Script

Problems with error 512 more than 1 result returned due to the operator outside of the query. Found this when tested with multiple blocks going on at once. It worked fine when there was only 1 block. Depending on the type of server there can be a "whole lot of blocking going on "Replaced with […]

You rated this post out of 5. Change rating


805 reads

Technical Article

SQL Server Current Activity SuperCheck

  • Script

This gives a quick check of the current activity on a SQL Server. I developed this after getting continually frustrated with "Current Activity" in SQL/EM getting blocked by processes when I needed to see blocking issues on the server. It has been immensely valuable to me in quickly identifying production-stopping issues on the database. It […]

4.2 (5)

You rated this post out of 5. Change rating


4,865 reads

Technical Article

Kill All Users in A Given Database

  • Script

This script will kill all users in a given database. Before disconnecting, it can optionally send the user a NET SEND Message giving them a warning to disconnect. To run, simply call it like usp_killusers 'dbname'. Make sure the @dbname parameter is not the master database.

4.17 (6)

You rated this post out of 5. Change rating


4,400 reads


Executing One Line in VSCode–#SQLNewBlogger


I wrote about arrays in PowerShell last week, but I realized one of the...

Friday Flyway Tips–Comparison Options


Recently a customer asked how they could get index changes to be captured in...

A New Word: Guiltwrights


giltwrights  – n. the imaginary committee of elders that keeps a running log of...

Read the latest Blogs


Selecting from a view, base table has a DENY on a column

By pveilleux

This is something I've never seen before and I can't think of the right...

JSON data with Pivoted

By Tava

Hi All, I need some assistance and not sure how to achieve the expected...

SQL Window Functions Series: LAG() and LEAD()

By Nikhil Bangad

Comments posted to this topic are about the item SQL Window Functions Series: LAG()...

Visit the forum

Ask SSC Logo Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers