On a project I’m working on, I had to set the database owner. So I opened up SQL Server Management Studio, opened the Properties for the database and tried to set the owner. But it failed with the following error:
The proposed new database owner is already a user or aliased in the database.
It looks like you cannot set the owner of the database to a user that is already used for this database. To fix it, you first have to remove the user from the list of logins.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE Northwind | |
GO | |
SP_DROPUSER 'myexistinguser' | |
GO | |
SP_CHANGEDBOWNER 'myexistinguser' |