Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you change the owner of a database in sql?

Tags:

sql

sql-server

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.

like image 376
Ryan Avatar asked Feb 19 '09 15:02

Ryan


People also ask

How do I change the owner of a SQL Server?

Expand SQL Server Agent, expand Jobs, right-click the job, and then click Properties. In the Owner list, select a login. You must be a system administrator to change the owner of a job. Assigning a job to another login does not guarantee that the new owner has sufficient permission to run the job successfully.

How do I change the owner of a schema in SQL?

To change the schema of a table by using SQL Server Management Studio, in Object Explorer, right-click on the table and then click Design. Press F4 to open the Properties window. In the Schema box, select a new schema. ALTER SCHEMA uses a schema level lock.

How do I find the owner of a SQL database?

One of the easiest ways to determine the database owner is to view its properties. Using either SQL Server Management Studio (SSMS) or Azure Data Studio (ADS) drill down to the database, right click on it, and select Properties to open the following window. Under the Database heading, you'll see its owner.

How do I add a database owner in SQL Server?

Click the Database Access tab. In the list at the top, in the Permit column, select the check box for the database to which you want to assign the owner role for the CES administrative account. In the Permit in Database Role list, select db_owner. Click OK.


1 Answers

Surpisingly, it's called sp_changedbowner.

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

like image 142
Quassnoi Avatar answered Oct 12 '22 02:10

Quassnoi