Created
June 16, 2017 13:01
-
-
Save jmelosegui/909e6f742819a11998a2d7dab95ef940 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Detect | |
sp_change_users_login 'report' | |
-- Repair | |
SELECT 'EXEC sp_change_users_login ''Update_One'', '''+[name]+''', '''+[name]+'''' | |
FROM sys.database_principals WHERE | |
type_desc='SQL_USER' | |
and NAME NOT IN ('dbo','guest','INFORMATION_SCHEMA','sys') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment