在 SQL Server 2005 中更改数据库图表的所有者 [英] Change Owner of Database Diagram in SQL Server 2005
问题描述
我需要更改 SQL Server 2005 中数据库图表的所有者.目前它归我所有 (domain\username.diagramName),我想将其更改为 dbo (dbo.diagramName) 所有.我以为我可以使用 sp_changeobjectowner,但我相信这仅适用于表、存储过程等......我认为这很容易,我只是无法通过谷歌搜索找到任何东西.
I need to change the owner of a database diagram in SQL Server 2005. Currently it is owned by me (domain\username.diagramName) and I would like to change it to be owned by dbo (dbo.diagramName). I thought I could use sp_changeobjectowner, but I believe that is only for tables, stored procedures, etc... I think this is pretty easy, I just haven't been able to find anything through a google search.
推荐答案
最后,我不得不删除该用户架构,然后运行以下更新...
In the end, I had to remove that users schema then run the following update...
-- to identify the diagram id, name, & owner
select *
from dbo.sysdiagrams
-- to manually change the owner of a diagram
-- note: i derived that the principal_id =1 for dbo from above query
update
dbo.sysdiagrams set principal_id =1 where diagram_id = 1
我最终从校园里的 DBA 那里得到了我需要的帮助.
I ended up getting the help I needed from a DBA here on campus.
这篇关于在 SQL Server 2005 中更改数据库图表的所有者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!