A Unique Developer

SQL Server 2005/2008 and database diagram creation error.

I really love database diagram feature of SQL server. Recently I have installed Sql server 2008 edition and it diagram feature stop work for me. Showing below annoying error although I have dbowner rights.

"Database diagram support objects cannot be installed because thisdatabase does not have a valid owner.  To continue, first use the Filespage of the Database Properties dialog box or the ALTER AUTHORIZATIONstatement to set the database owner to a valid login, then add thedatabase diagram support objects."

After doing googling I found solution and it is really simple. Do following steps to enable database diagram.

  1. Highlight database for which you want to enable database diagram.
  2. Select Property from context menu.
  3. Highlight Options and choose SQL Server 2005 (90) from compatibility level dropdown. Database Property
  4. Highlight Files options and set owner SA or any other user who has dbowner rights. You can click on button next to text field to search available user.Database Property
  5. Click on OK to save changes.
  6. Try to access "Database Diagrams" option again (You may need to refresh the database).