How to change the login for an existing user?

  • How to change the login for an existing user? I copied the mdn and ldb files from one server to another and attached the database. One of the database users is a owner of many objects. But this user does not appear in the security > login. When I try to add that user, it gives error 21002: [SQL DMO] User 'mav' already exists.

    How can I add this user using 'mav' as the login for the database?

  • The user is orphaned. Look at BOL for info on sp_change_users_login, or you can do a search here on the site for tons of related articles and posts.

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

  • Thanks a lot

    It worked.

  • Thanks Andy , this should be highlighted on this site It fixed my 21002 error with login (restored Db from Prod )

     

       

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply