Monday, February 21, 2011

Database diagram support objects cannot be installed because this database does not have a valid owner

In SQL 2005, if you get this message when trying to create a new Database Diagram:

"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 are the sql statements to resolve this:

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

No comments: