It’s friday and it’s dark and drizzling outside which usually makes me lazy..,:) But I got this one ticket from one of our customers requesting to create a Login which made me active :D.  Well, thought creating a login is just a basic routine security request, Went ahead and tried creating the login from SSMS. It failed…saying “The server principal already exists”1

Well, I thought the login already exists and verified from SSMS( I didn’t found one…Hmmm Interesting). Assuming might be a bug in SSMS, i tired using T-SQL, same message again…as you can see below.

2

Basically, I am not seeing the login(Server Principal) but SQL Server says it already has one!!!…To double check I queried sys.server_principals and also used sp_helprevlogin to see if it can show something useful to me.  But I had no luck again as you can see below…they are not giving me any useful results when I am querying using Login Name.

3

Now..It’s time to play with SIDs(SUSER_SID is super useful in this scenario). I queried SUSER_SID passing the login name which I am trying to create, Interestingly it returned a row as you can see below…

4

Right away I queried sys.server_principals again, but with SID(Use the SID which came from the above query) this time as opposed to Login Name. Results are shown below

5

Tadaaaaa…..There you go! It returned a different login name which already exsits on the SQL Server with the same SID of the new login which I’m trying to create. 

So, I contacted customer saying ‘ Hey, Login A is conflicting with your login, do you happen to know what Login A is?’ I got a response, that was her Old Windows user account(her Lastname got changed recently)

Now all I’ve to do is drop her old login(Remove DB mapping as needed) and create new login, fix DB mapping and permissions. Hope this helps…Happy Friday folks 🙂

9 responses to “The server principal already exists – Msg 15025, Level 16, State 2, Line 1”

  1. Marc Avatar
    Marc

    Genius! Thanks!

  2. badgirlmeat Avatar
    badgirlmeat

    THANK YOU!

  3. mohan chhapadia Avatar
    mohan chhapadia

    thank you.

  4. Ales Avatar
    Ales

    Excellent finding mate, it shed some light into my issue I was onto 🙂

  5. Wayne Avatar
    Wayne

    Thanks, really helpful!!!

  6. Shiva Avatar
    Shiva

    nice!!!

  7. Julie Hargraves Avatar

    I just had this same issue this morning, and this article really helped, but the login had a lot of databases it was user for, and I really didn’t want to recreate them all. So I did some more digging and found this on a Stack Overflow page:

    ALTER LOGIN [DomainName\OldUserName] WITH NAME = [DomainName\NewUserName];

    Made it much easier to update! Thought I’d share.

    1. sreekanth bandarla Avatar
      sreekanth bandarla

      Thanks for sharing.

  8. Tajana Avatar

    Thanks, it was very helpful!

Leave a reply to Julie Hargraves Cancel reply

I’m Sreekanth

Welcome to MSSQLTREK, my little corner of the internet where I geek out about SQL Server, databases, and all things cloud. This blog is my space to share lessons learned, cool tips, real-world troubleshooting stories, and the occasional deep dive into data and performance. Whether you’re a fellow Cloud Architect, DBA, Developer, or just cloud-curious, come along for the ride — let’s explore, optimize, and build awesome data solutions together!

Let’s connect