Unable to Cast Object Type of System.DBNull to System.DBStri

angeloangelo Posts: 4
edited August 1, 2008 6:50AM in SQL Compare Previous Versions
I'm trying to campare a SQL Server 2005 db to an almost identical SQL Server 2000 db. No matter what I do I get the following message.

Unable to Cast Object Type of System.DBNull to System.DBStringIt seems to be happening when Reading Constraints.
I tried rebooting, uninstalling and reinstalling and I still keep on getting the same error.

I have no clue where to start looking. I've got over a hundred tables with near that many constraints. Where do I begin looking. I was hoping COMPARE could at least tell me what constraint is giving it a problem.

Any clue??? Any help would be appreciated.

PS (I thought I posted this already, but I don't see it)


  • Hi Angelo,

    If you can send me ([email protected]) some snapshots or scripts of the databases in question, I'll take a look for you and see if I can shed some light onto what the problem might be.

    Alice Easey
    Red Gate Software
  • Hi am getting this same issue. Did support manage to recreate it (and could they reply on the thread if they did pls)

    Many thanks
  • There are a variety of different problems that cause this issue, all of which are basically 'SQL Server returned a null from a query in a place we weren't expecting it to'. This is usually a result of minor database corruption of some kind - running DBCC checkdb will often locate the problem.

    If that doesn't pin it down, running a SQL Profiler trace while SQL Compare is working will let you see what the last query before the error was, and running that query against your database should give you a result with some nulls in it. Either you might be able to spot where the nulls shouldn't be, or you could then send that query and the results to us and we should be able to tell you what's wrong.
    Software Developer
    Redgate Software
Sign In or Register to comment.