SQL Server Error 15517

There is a good article at SQLServerCentral.com that helps you troubleshoot this error 15517 on SQL Server. I got this error when I tried to create a database diagram on one of my databases. The other databases were fine. The article is called Troubleshooting SQL Server Error 15517.

I read the article and executed the suggested queries. Sure enough when I executed the following query, the database in question had NULL for the dbo_login.

EXEC sp_MSForEachDB 
'SELECT ''?'' AS ''DBName'', sp.name AS ''dbo_login'', o.name AS ''sysdb_login''
FROM ?.sys.database_principals dp
  LEFT JOIN master.sys.server_principals sp
    ON dp.sid = sp.sid
  LEFT JOIN master.sys.databases d 
    ON DB_ID(''?'') = d.database_id
  LEFT JOIN master.sys.server_principals o 
    ON d.owner_sid = o.sid
WHERE dp.name = ''dbo'';';

The solution was to substitute my database name in for “Example” in the following code from the article at SQLServerCentral.com. After running that I was able to create database diagrams for that particular database!


Leave a comment

Your email address will not be published. Required fields are marked *