Trouble Creating SQL Server Login: Conflicting Errors

I’m having a weird issue with SQL Server logins. When I try to make a new login, it says it already exists. But when I try to remove it, it says it doesn’t exist. Here’s what’s happening:

I run this:

CREATE LOGIN [mycompany\DBGroup] FROM WINDOWS;

And I get:

The server principal ‘mycompany\DBGroup’ already exists.

So I try to delete it:

DROP LOGIN [mycompany\DBGroup]

But then I get:

Cannot drop the login ‘mycompany\DBGroup’, because it does not exist or you do not have permission.

I’m using a sysadmin account, and the login doesn’t show up when I check sys.server_principals. Any ideas what’s going on here? It’s driving me crazy!

hmm, interesting problem! have u checked if there’s a user mapped to that login? sometimes they can cause confusion. also, maybe try creating the login with a different name and see if it works? could help narrow down the issue. what version of sql server r u using btw?

sounds like a weird sync issue with ad, mate. have u tried flushing the ad cache? sometimes that fixes these funky login probs. also, check if theres any orphaned SIDs hanging around - they can mess things up too. good luck!

This is indeed a perplexing situation, LucasPixel23. I’ve encountered similar issues before, and it’s often related to Windows authentication complexities. One possibility is that the login exists at the Windows level but not in SQL Server. Try running ‘SELECT * FROM sys.server_principals WHERE name LIKE ‘%DBGroup%’’ to double-check. If it’s not there, the issue might be with Active Directory synchronization. Another approach is to use T-SQL to create the login with ‘IF NOT EXISTS’ clause, which bypasses the error. If all else fails, restarting the SQL Server service sometimes resolves these quirks. Let me know if any of these suggestions help or if you need further assistance troubleshooting.