Scenario : Sql Server 2005 con un database appena creato tramite uno script
Problema : Non si riescono a creare Database Diagrams, in quanto il supporto per la funzionalità stessa non è presente e ad ogni tentativo viene visualizzata una dialog di errore con scritto il messaggio : “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.”. Andando nelle proprietà del database, seguendo le indicazioni del messaggio non sembra risolversi il problema.
Soluzione : Eseguire il seguente script :
use [master] EXEC sp_dbcmptlevel 'yourDB', '90'; go ALTER AUTHORIZATION ON DATABASE::yourDB TO "yourLogin" go use [yourDB] go EXECUTE AS USER = N'dbo' REVERT go
