Mapping a Login to a Database at the Instance level

  • Friends,

    I am trying to map a Login to one of the Databases in the Server Instance. However, I am unable to do so through SSMS.

    I have login xxxxxxxx at the Instance Level. I am trying to map this Login to one of the DBs in this Instance. I going to the properties page of the login through Security folder and going to the User Mapping options. I am clicking the check box of the DB that i want say A and clicking on the OK button. The window shows as if it is executing. However, when I check the properties again, this DB remains unchecked.

    Is there a script using which we can map a DB to a Login at the Instance level.

    thanks

    Murali

  • I got the issue resolved by deleting the User from the Database and mapping the login to the DB after that..

  • MuraliKrishnan1980 (7/9/2013)


    I got the issue resolved by deleting the User from the Database and mapping the login to the DB after that..

    for future reference there's no need to delete the user. Use either

    USE [yourdb]

    GO

    exec sp_change_users_login 'UPDATE_ONE', 'dbusername', 'loginname'

    Or

    USE [yourdb]

    GO

    ALTER USER dbuserName WITH LOGIN = loginName

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

Viewing 3 posts - 1 through 2 (of 2 total)

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