Published on November 24th, 2014 | by Alejandro Cordero0
SQL Server 2014 Orphaned User
Msg 229, Level 14, State 1
%s permission denied on object %.*s, database %.*s, owner %.*s
Microsoft SQL-DMO (ODBC SQLState: 42000) Error 15023: User or role ‘%s’ already exists in the current database.
You might have an orphaned user. This means your login and database user are not matching properly, this happens usually after a SQL Server migration, database restore or certain maintenance tasks.
1- Run a report and make sure if in fact you have an orphaned user
USE adventureWorks GO sp_change_users_login @Action='Report' GO
2-Re-map your user and login with the code below
USE AdventureWorks GO exec sp_change_users_login @Action='update_one', @UserNamePattern='TestUser1', @LoginName='TestUser1' GO
MSDN Reference: http://msdn.microsoft.com/en-us/library/ms175475.aspx
These are quick references by SQLTurbo, intended for quick review of commands
and quick solutions to common sql errors. This section does not elaborate
on topics deeply. However feel free to comment and we will try to make
suggestions as needed.