Click here to Skip to main content
15,893,814 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have a small database (.mdf)file which I attached in SSMS so that I can see the tables in the Object Explorer. However I am unable to create Database Diagram for this database and I receive and error each time I attempt to do that. So I can't establish any relationships or perform any action.

ERROR: Cannot execute as the database principal because the principal "dbo" does not exist. This type of principal cannot be impersonated or you don not have permission. (MSSQL Server Error 15517)


In Visual Studio I can open the database as an ADO.Net Entity Framework Model but cannot create any relationships there either. So, the database is a group of unrelated tables, that are more-or-less useless.

Any constructive suggestions would be helpful.

Thanks.

What I have tried:

I have recreated the tables several times, but have not entirely recreated the database from scratch.
Posted
Updated 1-Jan-17 18:03pm

1 solution

Try giving a database owner to your database. That resolves the error for me in the past.

If you still get error, please check following threads, if these help resolve your issue -
sql server - Cannot execute as the database principal because the principal "dbo" does not exist - Database Administrators Stack Exchange[^]
sql server - Cannot execute as the database principal because the principal “guest” does not exist - Database Administrators Stack Exchange[^]


Hope, it helps :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900