I have run into a "good old" problem on SQL Server 2005 Express. When I select the "Database Diagrams" node in SSMS, I get the message:
Database diagram support objects cannot be installed because this database does not have a valid owner (...)
I have fixed this before, and a google-search gives loads of hits, so it's a well known thing. However, the suggested remedy is always the same, either:
1) Choose database properties, select the Files page and set the owner to a valid login, or
2) Execute this:
EXEC sp_dbcmptlevel 'yourDB', '90';
go
ALTER AUTHORIZATION ON DATABASE::yourDB TO "yourLogin"
go
use [yourDB]
go
EXECUTE AS USER = N'dbo' REVERT
go
The problem is that the database already seems to have a valid owner:
1) The dbo user is mapped to my login 2) My login is set up as the database owner on the db owner/files page 3) The compatibility level is 90 (SQL Server 2005)
The above SQL has no effect - the "EXEC sp_dbcmptlevel" of course does nothing, the "ALTER AUTHORIZATION" executes, but seems to accomplish nothing, and the REVERT gives the message:
Could not obtain information about Windows NT group/user 'MYDOMAIN\MyLogin', error code 0x54b
That last bit has me puzzled, and may be a clue. The login certainly exists - I am currently logged in with it, and the computer is also in the domain.
Any clues?