37

In management studio you can see the owner under properties but it won't let you change it. My guess is there's some stored procedure to change it and you can't do it through the gui.

3 Answers 3

47

Surpisingly, it's called sp_changedbowner.

You can actually change it in SQL Server Management Studio under Database / Properties / Files

Sign up to request clarification or add additional context in comments.

Comments

34

In addition to using SSMS GUI, you can also use ALTER AUTHORIZATION or alternately use sp_changedbowner statement.

ALTER AUTHORIZATION ON DATABASE::MyDatabaseName TO NewOwner; GO 

Please note sp_changedbowner is deprecated from SQL Server 2012.

3 Comments

I saw that method online (and your onliner worked, +1 for that). Any insight why there are two different ways?
ALTER AUTHORIZATION is a DCL in T-SQL that is used to alter authorization of database objects that have owners associated. sp_changedbowner is a Microsoft's implementation of the same function as a System Stored Procedure. In fact, sp_changedbowner is deprecated from SQL Server 2012, and using it is not a best practice anymore. Please refer Microsoft's documentation at msdn.microsoft.com/en-us/library/ms178630.aspx.
This should be the answer considering the deprecation!
11

Actually you can change it in SSMS, it's in the Files tab on the database properties.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.