Wednesday, January 27, 2016

How to resolve the “The server principal “Domain\LoginName” already exists” Error Msg 15025, Level 16, State 2, Line 1



Step1: SELECT SUSER_SID( 'Domain\LoginName');
SID:0x010500000000000515000000C5F84793CB280B51AD7C2F5320370000

Step2:
Select * from sys.server_principals
where SID=0x010500000000000515000000C5F84793CB280B51AD7C2F5320370000
go

Step3:
drop login [Domain\LoginName']
go

Step4:
CREATE LOGIN [Domain\LoginName'  FROM WINDOWS WITH DEFAULT_DATABASE=[master],
DEFAULT_LANGUAGE=[us_english]
 go

Step5: If required, this is for a particular database
 USE AuditDB
 go
EXEC sp_addrolemember 'db_datareader', 'Domain\LoginName''
GO

No comments:

Post a Comment

https://blog.sqlauthority.com/2009/06/27/sql-server-fix-error-17892-logon-failed-for-login-due-to-trigger-execution-changed-database-context...