SP_Helpdb error

SP_HELPDB not running properly –

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.The statement has been terminated.

Cause : This is caused by missing owner of a database.

Please run the following query in Query Analyser.

MASTER.dbo.sysdatabases WHERE SUSER_SNAME(sid) IS NULL


SELECT name, SUSER_SNAME(sid), CONVERT(NVARCHAR(11), crdate), dbid, cmptlevel 
FROM MASTER.dbo.sysdatabases

Remember, If Null is reported run the following to generate the query to fix the issue.

SELECT 'USE ' + name + '; EXEC sp_changedbowner "sa";' FROM 
MASTER.dbo.sysdatabases WHERE SUSER_SNAME(sid) IS NULL

This would generate Query to change the dbowner for problem database.



Please let me know for any concern….

Amit 🙂


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: