After attaching a database, you cannot view the database relationship diagram or establish a database relationship diagram.
My solution is as follows:
1. Set the compatibility level to 90 (2005 to 90) (2000 to 80)
Copy codeThe Code is as follows: USE [master]
GO
EXEC dbo. sp_dbcmptlevel @ dbname = 'database name', @ new_cmptlevel = 90
GO
[This command has been executed: "DBCC has been executed. If DBCC outputs an error message, contact the system administrator ", report "this database lacks one or more support objects required to use the database relationship diagram, whether to create", select "yes", the problem is resolved]
Alternatively, right-click the database you restored, choose Properties> Options> Compatibility Level, select sqlserver2005 (90), and click OK.
When you expand the "database relationship diagram" node under the database, you will be prompted, "This database lacks one or more support objects required to use the database relationship diagram, whether to create ", select "yes.
2. If the problem persists after performing the above operations, continue as follows:
Select your database, select "security"-> "user", and select dbo to open the attribute page. If the logon name is empty, create a new query and
Copy codeThe Code is as follows: use [your database name]
EXEC sp_changedbowner 'sa'
After the execution is successful, select the "database relationship diagram" node and prompt "this database lacks one or more support objects required to use the database relationship diagram, whether to create ", select "yes. You can see the previously created graph.