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)


By David A. Long,

Microsoft's Transfer or Drop the logins and the passwords between instances of SQL Server 2005 script:

Modified the Microsoft example to add:

@include_role = 1 parameter will add generate sp_addsrvrolemember script

@drop_accounts = 1 parameter will add generate DROP instead of CREATE works with @include_role to generate sp_dropsrvrolemember script

Generates the script to limit the LOGINs scripted to those related to a single database (requires search and replace for database name in this script and stored procedure re-creation)

Adds EXISTS logic to eliminate the need to edit script to eliminate error if the object already exists

Adds self-documentation to generated script & execution



Total article views: 2327 | Views in the last 30 days: 9
Related Articles

Generate Insert script

Generate Insert script


Generate Script File Name

Generate Script File Name


Generated script to update statistics

Generated script to update statistics


Generate scripts for all databases

Generate scripts for all databases


A Standard Database Security Script Generator

A script generator for standard security compliance.


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

Already a member? Jump in:

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