SQL Server exclusive access, prevent connections to DB accept your own

Im about to embark on a rather large upgrade of our live webserver. It includes both DB and ASP.NET updates
For this i am going to need exclusive access to the DB while i perform the reuired operations. After trawling the internet for a few minutes i stumbled across a great article with some SQL script.
Here it is, the only change I made was so that when you run the procedure, if it encounters your connections username in the list it will ignore it.
So if you are connecting to the instance of SQL via managment studio on your temrinal, or remotely but using your login credentials, you will be denying access to a DB for everyone accept your connection username.

Originally posted by Tony Regerson
http://sqlblogcasts.com/blogs/tonyrogerson/

Leave a Reply

Your email address will not be published. Required fields are marked *