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
I ended up getting the help I needed from a DBA here on campus.
UPDATE dbo.sysdiagrams
SET principal_id = 1
Set a WHERE clause if needs be. The text above suggests you need to remove the user from the database, but I didn't have to do that. I'm using SQL2008 R2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With