Search This Blog

sp_helpdb gives error.........

sp_helpdb give you error

Some times when you try to use sp_helpDB you may get the following problem. It can result in your database even not backuped up.

Server: Msg 515, Level 16, State 2, Procedure sp_helpdb, Line 53
Cannot insert the value NULL into column '', table ''; column does not allow nulls. INSERT fails.


This error might be because your database have an invalid owner.
You can identify the databases with this issue using the followng script.

use master
go
SELECT name, SUSER_SNAME(sid)
FROM sysdatabases
WHERE SUSER_SNAME(sid) IS NULL.


The above statement will lists the databases with invalid database owner.
In order to fix this, just change the ownership of the database.

exec sp_changedbowner 'sa' -- u can specify the desired owner instead of 'sa'

No comments: