Coder
Coder

Reputation:

How can we dis-connect all the active users on sql-server 2005 express using sql

How can we dis-connect all the active users on sql-server 2005 express using sql

Upvotes: 4

Views: 126

Answers (2)

HotTester
HotTester

Reputation: 5798

Just fire this sql query:

USE [master] 
GO

 ALTER DATABASE MyDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE; RESTORE DATABASE MyDB FROM DISK = 'backupfile path' WITH REPLACE

Upvotes: 1

Doogie
Doogie

Reputation: 815

USE [master]
GO
ALTER DATABASE [YourDB] SET  SINGLE_USER WITH ROLLBACK IMMEDIATE
GO

Your Restore Statement

ALTER DATABASE [YourDB] SET  MULTI_USER
GO

Upvotes: 0

Related Questions