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'

Comments

  1. Helpful posting. Thanks!!

    ReplyDelete
  2. Excellent post for those of us MOM admins who don't know squat about SQL. Thx much!

    ReplyDelete
  3. Very good post.. helped me out! :-)

    ReplyDelete
  4. Thanks a lot for your post. It's very useful

    ReplyDelete
  5. Thanks, you saved my day :)

    ReplyDelete
  6. Still useful!! :)

    -Bryce

    ReplyDelete

Post a Comment