Wednesday, March 18, 2009

Removing users with backslash in SQL Server

I'm writing this more as a reminder to myself than anything else, because it's the second or third time that I forget this thing and spend some value time figuring out what's going on.

Today I was requested to restore a database on our Production Server in order to create a new database for some pre-production tests.

After the backup I ran the sp_change_users_login to fix the broken database users links, and everything.

However as I listed the sysusers table I noticed some user names starting with a backslash '\' that I couldn't remove with sp_dropuser.

So, in order to remove this names from the sysusers the right call is the sp_dropalias.


Post a Comment