sp_change_users_login [ @Action = ] 'action'
[ , [ @UserNamePattern = ] 'user' ]
[ , [ @LoginName = ] 'login' ]
[ , [ @Password = ] 'password' ]
This example produces a report of the users in the current database and their security identifiers.
EXEC sp_change_users_login 'Report'
--Change the user account to link with the 'Login1' login.
USE DB1
go
EXEC sp_change_users_login 'Update_One', 'OrphanUser', 'Login1'
This example shows how to use the Auto_Fix option to map an existing user to a login with the same name, or create the SQL Server login 'Login1' with the password '@a122ld' if the login Mary does not exist.
USE pubs
go
EXEC sp_change_users_login 'Auto_Fix', 'Login1' , NULL,a122ld'
go
No comments:
Post a Comment