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
Thanks! Works 100%, after failing to solve this problem using the Properties/Files/Owner settings recommended by MS.
# Posted By Willem Fourie | 1/25/07 9:08 AM
Thanks for the hint--I had already changed owners from my WinNT login to "sa", but I got the same error. Rather than use the command line, though, I used Management Studio to change the compatability level to "90". Once I did that and clicked on "Database Diagrams", I was asked if I wanted to install the Diagramming Objects, which I did, and I could see the diagram.

This was a database that was created with SQL 2000, detached, and then attached to SQL 2005, by the way...
# Posted By Steve Jackson | 1/25/07 12:02 PM
Thank you for this! MS does not refer to sp_dbcmptlevel. Big help when I created a datawarehouse
# Posted By Kane Atkinson | 4/20/07 11:45 AM
Thankyou for this. It did the job.
# Posted By CY | 6/4/07 10:19 PM
If you get this error after importing from SQL 2000 database make sure you set the compatibility Level to ‘SQL Server 2005 (90)’ in the Options section in database properties.

1.   Right Click your database and select ‘Properties’ at the bottom of the list.
2.   Click the ‘Options’ item on the left of the ‘Database Properties’ dialogue.
3.   Select the correct ‘Compatibility level’ in the drop down list.

Hope this helps.
# Posted By James Cochrane | 8/2/07 11:21 AM
This worked for me as well- this was the second instance of SQL Server 2005 that I have seen this issue. The MS technote did not solve it but this works perfectly!

Thanks.
Mike
# Posted By Mike | 8/14/07 4:31 PM
Thank very much. It works perfectly. I could not able to figure out what it could be but your solution is simply superb !!!
# Posted By Maulik | 9/21/07 9:08 PM
Thanks! I had imported a backup from another computer and the compatibility level was exactly what I needed to change. Frustrating error to debug! Thanks again!

<a href='http://jordan.broughs.net>Jordan Brough</a>
# Posted By Jordan Brough | 10/16/07 9:14 AM
Great work .............!
# Posted By faisal | 2/17/08 6:21 AM
works fine....
thanks
# Posted By Matthieu Boutiau | 3/25/08 7:11 AM
Thanks for this!!! Realy great
# Posted By kalc | 5/20/08 1:23 PM
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
This blog is running version 5.9.003. Contact Blog Owner