Object reference not set to an instance of an object

jbold005jbold005 Posts: 3
edited September 11, 2012 5:19PM in SQL Doc Previous Versions

When trying to document a database I recieve an error message on a few tables: "object reference not set to an instance of an object". Then the documentation for that database is aborded...I can still document the database if i leave out those tables. However i would really like these tables in the documentation. Is there anyway to fix this issue?


  • Eddie DEddie D Posts: 1,666 Rose Gold 5
    Thank you for your post into the forum and sorry that you have encountered a problem.

    What exact full version numer of SQL Doc v2 are you using? You can obtain this information from the help menu ->About SQL Doc.

    What version of SQL Server is the database you are attempting to document using?

    If attempting to document a SQL 2012 database, the tables that generated the reported error, are they configured to use any of the new SQL 20012 features or data types?

    Many Thanks
    Eddie Davis
    Product Support Engineer
    Redgate Software Ltd
    Email: [email protected]
  • The database is a SQL 2008 not R2 database and the SQL DOC version is
  • Eddie DEddie D Posts: 1,666 Rose Gold 5
    Thank you for your reply.

    Can you please provide a example table creation script for one or two of the tables that are causing you this problem?

    Many Thanks
    Eddie Davis
    Product Support Engineer
    Redgate Software Ltd
    Email: [email protected]
  • Was this issue ever resolved? I'd be very intersted in the resolution.

    I'm having the very same problem (SQL Server 2005, local OS: Windows 7, SQL Doc v2.1.2.1) and I'd like to know how to fix it. Unfortunately the SQL Doc log doesn't help me much but I'd be happy to make it available to anyone who thinks it might help them unravel this problem.

  • Brian DonahueBrian Donahue Posts: 6,590 New member

    Unfortunately "object instance not set to an instance of an object" is a very generic programming error, which has thousands of potential causes and will never by nature be a bug that can be "fixed".

    Typically in Red Gate SQL tools it means there is a bit of schema that depends on an object that cannot be read, either because it does not exist or you do not have permissions to it.

    So as a first-look I'd try running the program using a SQL sysadmin account or at least one that have VIEW DEFINITION rights on the schema.
  • Thanks for your response, Brian.

    I always use an account with Sysadmin permissions to connect to the SQL Docs 2 project.

    I've run DBCC Check on the database and found nothing wrong internally. If I remove the offending object from the list of objects to document, it stumbles over an object further down the list. If I remove that object and it stumbles over another object yet further down the list. I've tried this about 10 times and decided that even if it did finally succeed, the resulting documentation would be missing so many items as to be quite useless.

    It would be nice if SQL Doc would tell me what it's expecting to find that isn't there. It must know if there is an "object reference" in the first place. It doesn't do that, however, nor does it write this information to its log. If I knew what it was stumbling over, I could fix it, but there are just too many objects in this database to guess.

    Any ideas or strategies you may have for tracking down this "missing" object would be greatly appreciated.

    Thanks again, Brian.
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Red Gate SQL Tools do not handle corrupt schema/schema it does not understand very well. My apologies for that.

    My first step is usually to try debugging it, since the error handling built in to the software is not any help.
  • Hi pbezanson,

    We have opened a support ticket for you in regards to this issue. We will follow up with you shortly.

    Best Regards,
    Steve Tanori
    Product Support
    Red Gate Software Ltd.
Sign In or Register to comment.