Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 Revoking/Denying Rights On Database???
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

13 Posts

Posted - 09/15/2006 :  23:55:14  Show Profile
Well Dears!
I have a database script that i run from C# code , i Connect to sqlexpress via windows authentication or sa login, Script does the following things
1) Create a Database SECUREDB (Tables, Procedures etc).
2). create a new LOGIN
3) change database owner (sp_changedbowner) of SECUREDB to the new LOGIN
At the end i want to to revoke all rights of all logins including Windows Authentication from SECUREDB EXCEPT the one new LOGIN so that only new LOGIN should be able to connect to SECUREDB.
i need help in this regard how to do that. Any Script example or article would be highly appreciated.I am using SQLEXPRESS.

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 09/16/2006 :  00:01:13  Show Profile
Any login in the sysadmin fixed server role, for example SA, will still be able to connect to the database.

There is no way to prevent it if a login is sysadmin.

Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000