The server principal 'test-login' already exists.

  • Hello,

    I created a login by these two TSQL commands:

    CREATE LOGIN [test-login] WITH PASSWORD=N'mypassword, DEFAULT_DATABASE=mydb, DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF

    ALTER LOGIN [test-login] ENABLE

    Then I dropped the login with:

    CREATE LOGIN [test-login]

    When I try to create the login again I get the error:

    The server principal 'test-login' already exists.

    When I run the following line, i do get one record with the deleted login:

    select * from sys.server_principals where name = 'test-login'

    Question: is it okay to delete the record in the sys.serverprinciples table? Or what else must I do?

  • Raymond van Laake (1/26/2015)


    Then I dropped the login with:

    CREATE LOGIN [test-login]

    Err... CREATE LOGIN doesn't drop logins. Mis-paste?

    Question: is it okay to delete the record in the sys.serverprinciples table? Or what else must I do?

    You can't delete from the system tables. Back in SQL 2000 when it was possible, people used to fry their databases or entire instances by deleting from the system tables...

    If you run DROP LOGIN [test-login], what does SQL return?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • It was a typo indeed, I meant DROP LOGIN [test-login].

    I did solved it by the way by your suggestion to run it directly, then it worked well... it appeared that for some other reason the DROP command in my script was never executed...:doze:

    Thanks!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply