Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin.
Search for scripts directly from SSMS, and instantly access any saved scripts in your
SSC briefcase from the favorites tab.
Download now (direct download link)
Thank this author by sharing:
By Greg Drake,
This script contains various queries I have written on the subject of security as it applies to a specific database. It's arranged so I can either (A) run one query I need alone or (B) run the whole thing as a batch to dump out everything at once.
Option B might not seem useful at first (information overload!), but consider that if your output in SSMS is set to "Results to Text", this will allow you to quickly copy off a single text file that contains everything you might want to know about that database's security at a point in time. Furthermore, the queries are carefully structured and ordered to be consistent. This makes two of these text files easy to compare with a standard compare/diff/merge application (e.g. WinMerge, Beyond Compare).
The last query is a re-write of the 'report' mode of sp_change_users_login.
Please also see related script Security Queries: Server-level.
back up and restore security user login [database logins]
Secure Mechanism For Customer Login page
separate login for query
A set of queries which attempt to gather as much security-related information on a server instance a...
These scripts will extract security for Windows Logins, Database Users, Roles, Objects and SQL Login...