Error: Cannot Insert the value NULL into column '', table ''; - FogBugz Knowledge Exchange most recent 30 from http://fogbugz.stackexchange.com 2012-02-09T08:36:19Z http://fogbugz.stackexchange.com/feeds/question/258 http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://fogbugz.stackexchange.com/questions/258/error-cannot-insert-the-value-null-into-column-table Error: Cannot Insert the value NULL into column '', table ''; FogBugz KB 2009-10-15T00:20:31Z 2011-06-22T16:40:20Z <p>I'm getting the following error message:</p> <p><img src="http://www.fogcreek.com/FogBugz/KB/images/sp%5Fdbhelp2.gif" alt="err" title="" /></p> <p>Any help here?</p> http://fogbugz.stackexchange.com/questions/258/error-cannot-insert-the-value-null-into-column-table/259#259 Answer by FogBugz KB for Error: Cannot Insert the value NULL into column '', table ''; FogBugz KB 2009-10-15T00:23:41Z 2009-10-15T00:23:41Z <p><strong>Description:</strong>&nbsp;</p> <p>This indicates a problem with your SQL Server installation. At least one of the databases on your database server has a missing or corrupt owner. The system stored procedure "sp_helpdb", which lists your existing databases, requires a valid owner for every database in order to run.</p> <p>To see what's happening, open Query Analyzer and run: exec sp_helpdb. You will see an error message like the one above.</p> <p><strong>Common Cause:</strong></p> <p>Outside of SQL Server, the database owner's Windows account gets deleted. This sours things within SQL Server, it orphans that database.</p> <p><strong>Solution:</strong></p> <p>Following is the response I've seen two Microsoft reps post on groups.&nbsp; &lt;dbname&gt; is the database with the missing or corrupt owner. </p> <p>1) <br/><b>Use &lt;dbname&gt;</b><br /> <b>exec sp_changedbowner '[<em>new user not in db already]</b></em>'<br /> &nbsp; --this will work &amp; sp_helpdb will execute correctly<br /> <br /> 2) Then execute the same query using sa &amp; it will work: <br /> <b>Use &lt;dbname&gt;</b><br /> <b>exec sp_changedbowner 'sa'</b><br /> &nbsp;&nbsp; --The dependent aliases were mapped to the new database owner. Database owner changed.</p> <p>Of course, you may not know which database has the problematic owner. Here's from a Microsoft Rep (view thread):</p> <blockquote> <p>The database owner SID will become invalid if the owner's Windows account is<br /> deleted.&nbsp; This causes problems with sp_helpdb because of the NULL account<br /> name returned from SUSER_SNAME()..&nbsp; You can identify these problem databases<br /> with the script below and correct the problem by executing sp_changedbowner<br /> with a valid login.<br /> </p> <p> &nbsp;&nbsp;&nbsp; SELECT name<br /> &nbsp;&nbsp;&nbsp; FROM master..sysdatabases<br /> &nbsp;&nbsp;&nbsp; WHERE SUSER_SNAME(sid) IS NULL<br /></p> <br /><p>&nbsp;</p></b> </blockquote></p>