Rob Gonda's Blog

Database diagram support objects cannot be installed

If you ever get a message like this when trying to create a diagram in SQL 2005

"Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects."

Here's step by step what you have to do:

EXEC sp_dbcmptlevel 'yourDB', '90';
go
ALTER AUTHORIZATION ON DATABASE::yourDB TO "yourLogin"
go
use [yourDB]
go
EXECUTE AS USER = N'dbo' REVERT
go

TrackBacks
There are no trackbacks for this entry.

Trackback URL for this entry:
http://www.robgonda.com/blog/trackback.cfm?975501BD-3048-7431-E441EE7B633F611E

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
The first solution works great, thanks
# Posted By Alvaro Araya | 7/3/08 4:11 PM
Thanks. It works.
# Posted By Ben | 10/28/08 1:21 PM
Thanks for the excellent tip!
# Posted By marco | 11/7/08 4:10 AM
I'm having same problem with SQL Server 2008 Express edition. When I tried to execute this statements, I got "Could not obtain information about Windows NT group/user 'HOME\Administrator', error code 0x5". This is the account which I installed the SQL server 2008 Express. According to the Management Studio, this account owns the database as the DBO. Does this work with the SQL 2008 too?
thanks
# Posted By Ibrahim | 11/30/08 4:41 PM
Just wanted to share .... Thanks for the post .. it almost worked for me. I was trying to set the owner to an active directory account (via your code .. also tried via mgmt studio) and it wouldn't take. I eventaully tried setting the owner 'sa' and it finally worked (that and having compat level=90)
# Posted By Chad | 2/18/09 11:27 AM
This blog is running version 5.9.003. Contact Blog Owner