Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

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)

Capture_Login_Auths

By Donald Patterson,

This is an enhancement to the sp_helprevlogin stored procedure.  As a DBA I'm always asked to grant access to an account based on another and it can be difficult at times.   

This procedure takes in a login name, windows or SQL, and will generate the access and authorities for the login across the SQL instance.  The script generates the user's login, any server roles the login may have, database access and database roles that have been granted, and any specific permissions granted on the database and authorities granted on objects.  Everything gets outputed onto the message tab.  The output can be copied into a query window and with a replace of the login id, access can be quickly granted to another user.  
 
 If the login name is not provided, an error will be generated
 
 EX - sp_capture_login_auths 'domain name\snooze' 
 
 EX - sp_capture_login_auths 'snooze'

Total article views: 1835 | Views in the last 30 days: 35
 
Related Articles
FORUM

grant access to all databases

grant access to all databases

FORUM

How to grant a login access to that db when that db is in "StandBy /ReadOnly" mode?

How to grant a login access to that db when that db is in "StandBy /ReadOnly" mode?

FORUM

auto generate logins

auto generate logins

FORUM

Generating SQL Logins\users and permissions for a database

Generating SQL Logins\users and permissions for a database

FORUM

Auditing Logins and Their Access

Looking for T-SQL scripts that will show logins, rights and database they have access too

Tags
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones