Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Kill Processes in a Database

By Bruce Szabo,

This script kills all the processes using a given database.  It is useful for removing users from a database so it can be restored.

To use this script change the server variable and the database variable at the top of the script.  Notifications are written to the windows application eventlog.

Use this script at your own risk. It is always best to make sure you have an understanding of a script before implementing it.

Total article views: 1070 | Views in the last 30 days: 1
Related Articles

I need script related to databases

glnp scripts on database


Generate scripts for all databases

Generate scripts for all databases


Scripting Remote Database using SMO in .net

Can't script remote database using script method


Get Detach or Attach all user databases script

Script to generate script to detach or attach user databases