sqlsql-serverinvalid-object-name

How to identify & remove Invalid Objects in SQL Server database?


I have to work on a database in which there are many stored-procedures & views that are referencing non-existing tables & columns. How can I get the list of invalid objects (Tables, Columns) so I can fix it accordingly?


Solution

  • You could use SQL Prompt from Red Gate. It has a Find Invalid Objects feature that identifies stored procedures and views (amongst others) that refer to non-existent objects and tells you why.

    SQL Prompt is a commercial product -- you could use its 14-day fully-functional free trial period to tidy up your database right away though.

    Disclaimer: I work for Red Gate (on the SQL Prompt team).