Re-associate server login with database user? | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Re-associate server login with database user?

Hi all, I’ve had this issue in the past but dealt with it in a way that I don’t think is correct: Let’s say I have a database on Server1. On Server1 I create a login and a user on the database. Now I have User1 with a login authorization on Server1 as well as a user within my database. If I detach that database now, and re-attach it on a different server, User1 exists. Of course, on the new Server2 User1 does not have authorization to login. I’ve deleted the existing user in the database and then re-created a login on the server, cascading through with the GUI setup to re-create the user within the database, too. Of course this gets ugly if the user has objects within the database. If I create a server login with the same name as the database user the login is not associated with the user too, correct? I’d like to know the way that I can create a server authorization tied to the existing database user without dropping that database user, preferably within Enterprise Manager. Thanks all, MC
you can’t do it from EM, the stored procedure sp_change_users_login is what you’re looking for Cheers
Twan, you are the king. Exactly what I needed. Thank you.