Automations

Run sp_change_users_logins on All Databases

this will produce the script to run the sp_change_users_logins across all databases.

use master
go
set nocount on
select ‘use ‘ + name +char(10) + ‘go ‘ + char(10) + ‘print ”Database: ‘ + name + ””
+ char(10)+ ‘go ‘ + char(10) + ‘select ”sp_change_users_login ””update_one””, ”” + name + ””,”” + name + ”” + char(10) + ””go”” from sysusers where name not like ””db_%”” and name not like ””public”” and name not like ””guest””
+ char(10) + ””go””’ from sysdatabases where name not in (‘tempdb’)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s