Tuesday, April 05, 2011

In ability to create Database Diagram



If after you attach the MDF of an SQL Server Database, you are unable to create Database Diagrams and you get the following error each time you try:

"TITLE: Microsoft SQL Server 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."


The SQL Server is intelligent and also correct that your newly attached Database does not have a valid owner yet. Therefore, you new to locate a valid user on your SQL Server and assign the database to this user.

Running the following SQL command in your Query Window assigns the database to the user and you should be able to create your diagrams henceforth:

"ALTER AUTHORIZATION ON DATABASE::databaseName TO domain\user"

No comments: