简体   繁体   中英

Copy user with permission in SQL server 2008

I am Using SQL Server 2008 and have copied db from one machine to another. I am using a SQL login on machine A that have certain permission granted. How do I copy the user along with credentials to machine B? ( Both Machine A and Machine B running clone Databases )

Run sp_help_revlogin, which can be found here ( http://support.microsoft.com/kb/918992 ) to create the user from the source server.

If the SQL User already exists on the destination machine, run sp_change_users_login 'auto_fix', 'username" within the context of the db to link up the SIDs (more info on that command, here: http://msdn.microsoft.com/en-us/library/ms174378.aspx )

Hope that helps,

John

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM