SQL 你如何在sql中更改数据库的所有者?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/565780/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do you change the owner of a database in sql?
提问by Ryan
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.
在管理工作室中,您可以在属性下看到所有者,但它不会让您更改它。我的猜测是有一些存储过程可以更改它,而您无法通过 gui 进行更改。
回答by Quassnoi
Surpisingly, it's called sp_changedbowner
.
令人惊讶的是,它被称为sp_changedbowner
。
You can actually change it in SQL Server Management Studio
under Database / Properties / Files
你实际上可以在SQL Server Management Studio
下面改变它Database / Properties / Files
回答by user353gre3
In addition to using SSMS
GUI, you can also use ALTER AUTHORIZATION
or alternately use sp_changedbowner
statement.
除了使用SSMS
GUI,您还可以使用ALTER AUTHORIZATION
或交替使用sp_changedbowner
语句。
ALTER AUTHORIZATION ON DATABASE::MyDatabaseName TO NewOwner;
GO
Please note sp_changedbowner
is deprecated from SQL Server 2012
.
请注意sp_changedbowner
从SQL Server 2012
.
回答by SqlACID
Actually you can change it in SSMS, it's in the Files tab on the database properties.
实际上,您可以在 SSMS 中更改它,它位于数据库属性的“文件”选项卡中。