feedburner

Subscribe

View Venkat Varkala\

SQL Server Management Studio cannot create diagrams

Labels:

I always get below error while trying to create a database diagram in SQL Server 2005 Management Studio.

"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."
From my experience, this problem usually occurs with restored databases and there are two reasons,
  1. it is always recommended to restore databases with "sa" as owner.
  2. the database is SQL 2000 database and restored to a SQL 2005 Database engine
There are two approaches to this problem Approach 1 Run below statements on your database (of course replace "YOUR_DATABASE_NAME" with your database name) ALTER AUTHORIZATION ON DATABASE::[YOUR_DATABASE_NAME] TO sa go EXECUTE AS USER = N'dbo' REVERT go In case you get below error after running above statement, follow Approach 2 Msg 325, Level 15, State 1, Line 1 Incorrect syntax near 'REVERT'. You may need to set the compatibility level of the current database to a higher value to enable this feature. See help for the stored procedure sp_dbcmptlevel. Approach 2 If changing the owner to a valid user doesn't resolve this try following below steps
  1. Go to database properties.
  2. Select Options.
  3. Change "Compatibility Level" Dropdown to "SQL Server 2005(90)"

slqserverdiagram.JPG

0 comments:

Post a Comment