Kill All connection of a database


If you want to kill all the connection of a database at once then use below query.
you have to write your database name in place of DatabaseName (written in the below query)

USE master;
GO
ALTER DATABASE DatabaseName
SET SINGLE_USER
WITH ROLLBACK IMMEDIATE;
ALTER DATABASE DatabaseName
SET MULTI_USER;
GO

Comments

Popular posts from this blog

Grouping Sets, With Rollup and With Cube example

Adding Page brake aganist group values

To Get All the Names of tables and Databases their data have changed in last 24 Hours And Backup those databases