Wednesday, March 12, 2014

SQL Server: Create failed for User xxx. The login already has an account under a different user name. 15063

When you try to map an existing user to a database using SQL Server Management Studio - Security - Users - New User
You might see this error:
Create failed for User... The login already has an account under a different user name. 15063


Check the users mapped to the target database. You might be seeing this error because the login is already mapped to the database.


Run this query in your database:

select l.loginname as [login name],u.name as [user name] from DatabaseName..sysusers u inner join master..syslogins l
And you will see a list of user mappings.
DOMAIN\user1 - DOMAIN\user1 
DOMAIN\user2 - DOMAIN\user2
DOMAIN\user3witherror - dbo

Double check the dbowner of the database.
The owner is probably mapped to the user3witherror.

sp_changedbowner 'newowner'
re-map your login DOMAIN\user3witherror to the database 
(double click on the login  ->  User Mapping  ->  check the database -> check the permission level ->  OK

Related Posts Plugin for WordPress, Blogger...