// SQL Server error reference

SQL Server error 15025: The server principal already exists

CREATE LOGIN used a name (or SID) that already exists on the instance. Check for the existing login, or create it only if missing.

Error number
15025
Severity
16
Category
Permissions
Error message
The server principal '%s' already exists.

What it means

Login names are unique across the SQL Server instance, and so are login SIDs. Error 15025 appears when you create a login whose name, or the SID you specified to match another server, is already taken.

Common causes

  • Re-running a script that creates logins.
  • Copying logins between servers with SID = ... when a login with that SID but a different name already exists.
  • A Windows login added again under a different spelling of the same account.

How to fix it

  1. Check existing logins by name and SID.

    SELECT name, sid, type_desc FROM sys.server_principals WHERE name = N'app_user';
  2. Create the login only when it's missing.

    IF SUSER_ID(N'app_user') IS NULL
        CREATE LOGIN app_user WITH PASSWORD = N'<strong password>';

Related errors

More permissions errors

The code and message text are from the Microsoft Database Engine events and errors reference. Browse the full SQL Server error list or search every database error.

// fewer errors, faster fixes

Work on SQL Server in SQLly

A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for SQL Server and the other databases you use.