O R G A N I C / F E R T I L I Z E R: mom: sp_helpdb - cannot insert the value null into column

Jun 26, 2006

mom: sp_helpdb - cannot insert the value null into column

been getting any of these errors?

the system stored procedure sp_helpdb, which is used to gather information about the databases, has returned an error that may indicate that it cannot determine the db owner for the database [databasename].

here are the details:

sp_helpdb @dbname='databasename' on sql server instance: [instancename]. error number: 515, error information: [microsoft][odbc sql server driver][sql server]cannot insert the value null into column '', table ''; column does not allow nulls. insert fails.

this generally occurs when there's no owner specified for the database. executing this query will tell you if that's the case:
select name, suser_sname(sid) from master.dbo.sysdatabases where suser_sname(sid) is null
if indeed it does show up in this query, using sp_changedbowner will fix it. this will assign sa as the owner (make sure to change the database to the one you need to correct):
exec sp_changedbowner 'SA'