sql-serverdatabase-diagram

How to fix SQL Server database diagram error "Cannot execute as the database principal because the principal 'dbo' does not exist"?


When attempting to create a database diagram I get the following error:

Cannot execute as the database principal because the principal "dbo" does not exist

How do I fix this error?


Solution

  • This error occurs when the database owner for the files setting in the database properties is unassigned (or blank).

    To fix this:

    This gives the sa permission to create files on the server.

    You can also run this query to do the same thing:

    EXEC sp_changedbowner 'sa';
    

    src: SQL SERVER – Fix Error – Cannot execute as the database principal because the principal “dbo” does not exist