sp_helpdb fails to run succesfully

When I ran sp_helpdb on a SQL Server 2000 box, I got the following error:
Server: Msg 515, Level 16, State 2, Procedure sp_helpdb, Line 53
Cannot insert the value NULL into column ‘owner’, table ‘tempdb.dbo.#spdbdesc___ … __000100004AA1’; column does not allow nulls. INSERT fails.The statement has been terminated.

I narrowed this down to the statement [select name, suser_sname(sid), convert(nvarchar(11), crdate), dbid, cmptlevel from master.dbo.sysdatabases] within the sp_helpdb stored procedure. The database owner sid was not a valid user on the server, but a valid user on a different server from which the database had been restored

sp_changedbowner ‘insert_valid_user_here’ quickly corrected the problem.

Advertisements
Leave a comment

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: