To find Invalid Objects in SQL Server Database

  • Hi,

     

       How to find Invalid objects (Views, Procedures) in sql server databases.

     

    Regards,

    S.Balavenkatesh

  • How do you define "invalid"?

    John

  • Valid means - is the procedures is recently recompiled or when it will be last compiled.

     

     

  • Hi,
     
    Little bit confused with your question?
     
    Use these command to update the statistics for tables or indexes. Please checks BOL for motre information.

    DBCC SHOW_STATISTICS

    Displays the current distribution statistics for the specified target on the specified table.

    STATS_DATE

    Returns the date that the statistics for the specified index were last updated.

    sp_recompile

    Causes stored procedures and triggers to be recompiled the next time they are run.

    DBCC FREEPROCCACHE

    Removes all elements from the procedure cache.

    DBCC SHOWCONTIG

    Displays fragmentation information for the data and indexes of the specified table.

    Regards,
     
    Minaz Amin
     

    "More Green More Oxygen !! Plant a tree today"

  • Thanks

  • If you script all database objects and run the script in a new database, you'll find out very quickly which views and procedures are invalid because of references to tables or columns that have been renamed or dropped.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply