Fix for SQL Server Database with no owner

I came across an issue today in SQL Server Management Studio.  On a particular database I right clicked and selected properties and was presented with the following error:-

Cannot show requested dialog. (SqlMgmt)


Property Owner is not available for Database for abortion '[]'. This property may not exist for this object, or may not be retrievable due to insufficient access rights.  (Microsoft.SqlServer.Smo)

So I ran sp_helpdb
And sure enough under the database the owner was NULL
Just run the following command on the database without abortion legal an owner, here I am using sa but you can use whichever owner you want:-
EXEC sp_changedbowner 'sa'
Comments are closed