Autofix DB users
When you are copying databases across servers, the SQL users will lose their mappings.
Instead of deleting and recreating, you can use the autofix login script. This will try to match up the user on the database with one that is already available on the server.
If the user doesn't exist, then the script will create a new user with the supplied password.
Instead of deleting and recreating, you can use the autofix login script. This will try to match up the user on the database with one that is already available on the server.
EXEC sp_change_users_login 'Auto_Fix', 'username', NULL, 'password';
If the user doesn't exist, then the script will create a new user with the supplied password.

1 comments:
Never knew about the option to create a new user with the supplied password. Thanks for this.
Post a Comment