How to add login to an existing database user. | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

How to add login to an existing database user.

Hi Gurus, There is a login as raj and a user as raj in a particular database.
I wanted to add login to the user in that database.I tried to doing
the following … EXEC sp_grantdbaccess ‘raj’,’raj’ but I got this error… Server: Msg 15023, Level 16, State 1, Procedure sp_grantdbaccess, Line 143
User or role ‘huangy’ already exists in the current database. Please help. raj
The user is already in the database, No need to add him again. YOu can give him access to objects in the database. AKTHAR
When I am trying to give access to the logins it is giving error like user already exists and
also I am unable to delete the user because user owns objects in the database. Thanks raj
KBAhttp://support.microsoft.com/kb/314546 to fix the issue or you can drop the user and addit again. Satya SKJ
Microsoft SQL Server MVP
Writer, Contributing Editor & Moderator
http://www.SQL-Server-Performance.Com
This posting is provided AS IS with no rights for the sake of knowledge sharing. The greatest discovery of my generation is that a human being can alter his life by altering his attitudes of mind.
Thanks Satya, I used sp_change_users_login and it worked. Thanks
raj
I was about to suggest that one after posting above, but though the KBA link would have that reference. Satya SKJ
Microsoft SQL Server MVP
Writer, Contributing Editor & Moderator
http://www.SQL-Server-Performance.Com
This posting is provided AS IS with no rights for the sake of knowledge sharing. The greatest discovery of my generation is that a human being can alter his life by altering his attitudes of mind.
]]>