giammin

Fix orphaned SQL Server users

Oct 1st, 2014
451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --lists the orphaned users:
  2. EXEC sp_change_users_login 'Report'
  3.  
  4. --If you already have a login id and password for this user, fix it by doing:
  5. EXEC sp_change_users_login 'Auto_Fix', 'user'
  6.  
  7. --If you want to create a new login id and password for this user, fix it by doing:
  8. EXEC sp_change_users_login 'Auto_Fix', 'user', 'login', 'password'
  9.  
  10. An invalid parameter or option was specified for procedure ‘sys.sp_change_users_login’.
  11. pas NULL as 'login' parameter
Advertisement
Add Comment
Please, Sign In to add comment