<p>When I try to create a SQL Server Login by saying</p>

<pre><code>CREATE LOGIN [ourdomain\SQLAccessGroup] FROM WINDOWS;
</code></pre>

<p>I get this error</p>

<blockquote>
  <p>The server principal 'ourdomain\SQLAccessGroup' already exists.</p>
</blockquote>

<p>However, when I try this code</p>

<pre><code>DROP LOGIN [ourdomain\SQLAccessGroup]
</code></pre>

<p>I get this error</p>

<blockquote>
  <p>Cannot drop the login 'ourdomain\SQLAccessGroup', because it does not exist or you do not have permission.</p>
</blockquote>

<p>The user that I am executing this code as is a sysadmin.  Additionally, the user <code>ourdomain\SQLAccessGroup</code> does not show up in this query</p>

<pre><code>select * from sys.server_principals
</code></pre>

<p>Does anyone have any ideas?</p>

[{'answer_id': 21074, 'author': 'Pete', 'author_id': 76, 'author_profile': 'https://Stackoverflow.com/users/76', 'pm_score': 4, 'selected': True, 'text': '<p>We are still struggling to understand the <em>HOW</em> of this issue, but it seems that [ourdomain\\SQLAccessGroup] was aliased by a consultant to a different user name (this is part of an MS CRM installation).  We finally were able to use some logic and some good old SID comparisons to determine who was playing the imposter game.</p>\n\n<p>Our hint came when I tried to add the login as a user to the database (since it supposedly already existed) and got this error:</p>\n\n<pre><code>The login already has an account under a different user name.\n</code></pre>\n\n<p>So, I started to examine each DB user and was able to figure out the culprit.  I eventually tracked it down and was able to rename the user and login so that the CRM install would work.  I wonder if I can bill them $165.00 an hour for my time... :-)</p>\n'}, {'answer_id': 21115, 'author': 'jonezy', 'author_id': 2272, 'author_profile': 'https://Stackoverflow.com/users/2272', 'pm_score': 2, 'selected': False, 'text': "<p>is this when you are restoring from a backup or something?  I've found that the following works for me in situations when I'm having problems with user accounts in sql</p>\n\n<pre><code>EXEC sp_change_users_login ‘Auto_Fix’, ‘user_in_here’\n</code></pre>\n"}, {'answer_id': 55786743, 'author': 'Shadi Alnamrouti', 'author_id': 3380497, 'author_profile': 'https://Stackoverflow.com/users/3380497', 'pm_score': 0, 'selected': False, 'text': '<p>This happened to me when I installed SQL Server using a Windows username and then I renamed the computer name and the Windows username from Windows. SQL server still has the old "Computername\\Username" in its node of Server->Security->Logins.</p>\n\n<p>The solution is to go to Server->Security-><strong>Logins</strong> and right-click -> <strong>rename</strong> the old Windows user and use the new <strong>MachineName\\Username</strong>.</p>\n'}, {'answer_id': 56605391, 'author': 'OneGhana', 'author_id': 10754903, 'author_profile': 'https://Stackoverflow.com/users/10754903', 'pm_score': 0, 'selected': False, 'text': '<p>I faced similar issue and i believe the issue was as a result of trying to recreate a login account after deleting an existing one with same name.\nJust go through the various databases on the server using SQL Studio.\nExample steps:</p>\n\n<p>DBName ->Security->users</p>\n\n<p>at this level for each of the databases, you may see the name of the user account there. Delete all occurrence in each Database as well as its occurrence in the top level Security settings at </p>\n\n<p>Security->Logins</p>\n\n<p>When done, try recreating the login account again and you should be fine.</p>\n'}, {'answer_id': 57805923, 'author': 'Kuba D', 'author_id': 4314825, 'author_profile': 'https://Stackoverflow.com/users/4314825', 'pm_score': 0, 'selected': False, 'text': '<p>I had the same story as Shadi.\nOn the top I can add that it can be also done by query: </p>\n\n<pre><code>ALTER LOGIN "oldname\\RMS" WITH name="currentname\\RMS"\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/20998', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/76/']