General Error Messages (Volume 1)


SP_HELPDB error, is not running properly –

The exact error that you may see is something like the following:

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.

select name, suser_sname(sid) from master.dbo.sysdatabases where suser_sname(sid) is null

Or

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.

USE Mydatabase; EXEC sp_changedbowner ‘sa’;
USE Report; EXEC sp_changedbowner ‘sa’;

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: