User already exist | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

User already exist

Hi guys i know this quastions seems to simple but i did not understand when i try to create user in db i got this error. how to resolve it, please..how could we create alias in db and how to find out and add to role. TITLE: Microsoft SQL Server Management Studio
—————————— Create failed for User ‘NYC
oberti’. (Microsoft.SqlServer.Smo) For help, click:http://go.microsoft.com/fwlink?Prod…nExceptionText&EvtID=Create User&LinkId=20476 ——————————
ADDITIONAL INFORMATION: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) —————————— The specified user name is already aliased. (Microsoft SQL Server, Error: 15022) For help, click:http://go.microsoft.com/fwlink?Prod…9&EvtSrc=MSSQLServer&EvtID=15022&LinkId=20476 ——————————
BUTTONS: OK SRJ2005
Is the database restored from different server? You can use sp_addrolemember procedure to add to a role… MohammedU.
Moderator
SQL-Server-Performance.com All postings are provided “AS IS” with no warranties for accuracy.

HOW TO FIND ALIAS NAME IN DB.Because it is saying user does not exist in database. SRJ2005
Tod find the dbo alias run the following… exec sp_helpuser dbo Aliasing is deprecated in sql server 2005 and it will be removed from in future versions… Check BOL topic "sp_addalias" MohammedU.
Moderator
SQL-Server-Performance.com All postings are provided “AS IS” with no warranties for accuracy.

Run SP_CHANGE_USERS_LOGIN ‘Report’ to see whether this user reported as orphaned and if so run FIX option to fix it, check BOL for more information. 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.
when i run sp_helpuser dbo i can see sa login aliased to dbo i know sa login would not be aliased how to remove it . SRJ2005
You need use sp_changedbowner procedure to remove sa mapping… exec sp_changedbowner ‘LoginName’ — make sure user doesnot exists in the database other wise you get the following error… "The proposed new database owner is already a user or aliased in the database."
MohammedU.
Moderator
SQL-Server-Performance.com All postings are provided “AS IS” with no warranties for accuracy.

Thank you guys i fix it . SRJ2005
thanks it is working fine. SRJ2005
i thought it was fixed, but today i check it but looks same,
my login is ‘sa’ username ‘dbo’i need to change it to login ‘dbo’ and username ‘dbo’ how could it be done. SRJ2005
Don’t get confused: ‘sa’ is the login name corresponding to user name ‘dbo’. setuser ‘dbo’
select user_name(), suser_sname()
>> dbo sa setuser ‘adriaan’
select user_name(), suser_sname()
>> adriaan adriaan

]]>