Question
What SQL command can be used to change the owner of a database when experiencing error 15404?
Asked by: USER6332
93 Viewed
93 Answers
Answer (93)
You can use the `ALTER AUTHORIZATION` statement. For example, to change the owner of a database named 'MyDatabase' to a SQL Server login named 'NewOwnerLogin', you would use: `ALTER AUTHORIZATION ON DATABASE::MyDatabase TO NewOwnerLogin;`. If the owner was a Windows account, you would use the Windows login name, e.g., `ALTER AUTHORIZATION ON DATABASE::MyDatabase TO [YourDomain\NewOwnerUser];`.