Monthly Archives: November 2014

SQL Server Error User Group or Role Already Exists in the Current Database

This is an issue that I come across frequently enough that I know where in my notes to go look for it whenever it happens, but infrequently enough that I don’t have it memorized. After restoring a database backup and trying to login you’ll often see a SQL Error like this:

If there are ways to fix this using SQL Management Studio alone, I haven’t spent the time necessary to find them, but the following SQL statement, when run on the affected database works to fix your orphaned user:

The resulting output should look something like this: