What SQL command can be used to change the owner of a database when experiencing error 15404?

Responsive Ad Header

Question

Grade: Education Subject: Support
What SQL command can be used to change the owner of a database when experiencing error 15404?
Asked by:
93 Viewed 93 Answers

Answer (93)

Best Answer
(396)
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];`.