SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
Search:  
 
 

Find Guest user access level in all databases

By Mani Singh, 2008/08/06

Total article views: 932 | Views in the last 30 days: 20

I used the undocumented sp_MSforeachdb in EXAMPLE:1 to Query all Databases at once in one line code, or you can use a cursor for the same as shown in EXAMPLE:2

There may be other effieient methods and maybe some good use of DMV to same approach, but this is what i use as a Quick Reference, when needed.

I have also included the REVOKE Statement for refrerence, incase you want to remove the Guest access to your Database.

EXAMPLE:3 shows the diff methods to the REVOKE approach.

Just Twisting the Cursor statements a bit, we are able to define a all at onec or one row at a time REVOKE method.

WARNING!!! : TEST this on your TEST- SYSTEM First and use this SCRIPT at your own RISK only.

Study your environment before revoking access to GUEST User.

By Mani Singh, 2008/08/06

Total article views: 932 | Views in the last 30 days: 20
Your response
 
 
Related tags

Administrator     sp_msforeachdb    
Guest User     T-SQL    
Security    
 
Related content

A Hex on Your Database

By GSquared | Category: T-SQL
(not yet rated) | 3,786 reads
 
Contribute
Like this? Try these...

MD5

(not yet rated) | 508 reads

Free registration required...

To read the rest of this article, and access thousands of other articles, we ask you to register on the site and subscribe to our newsletters.

Login (existing users)

Login

Email:   Password:   Remember me: Forgotten your password?

Register (new users)

Register

Email:   Password:
Confirm:

Subscribing to our newsletters gets you:

  • ALL of our content (thousands of articles, scripts, and forum postings)
  • A daily newsletter (example)
  • A weekly news round up (example)
  • The opportunity to ask and answer questions in our forums
  • A daily Question of the Day to test and help you increase your knowledge of SQL Server.

Steve Jones
Editor, SQLServerCentral.com