Refreshing views

  • Hi all,

    I've got an issue where some of my views may need to be refreshed/recompiled but I am not 100% sure which ones. Does anyone have a script that will be able to let know me which ones will need to refreshed?

    Thanks

  • Views aren't compiled. If you want to know which views are dependent on a table that you've modified, you can use sys.dm_sql_referencing_entities. If, on the other hand, you're curious about which tables a view references yo ucan use sys.dm_sql_referenced_entities.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Grant Fritchey (10/15/2010)


    Views aren't compiled. If you want to know which views are dependent on a table that you've modified, you can use sys.dm_sql_referencing_entities. If, on the other hand, you're curious about which tables a view references yo ucan use sys.dm_sql_referenced_entities.

    What sp level do you need to run this on sql 2005? I just can't get this to work.

  • Ninja's_RGR'us (10/15/2010)


    Grant Fritchey (10/15/2010)


    Views aren't compiled. If you want to know which views are dependent on a table that you've modified, you can use sys.dm_sql_referencing_entities. If, on the other hand, you're curious about which tables a view references yo ucan use sys.dm_sql_referenced_entities.

    What sp level do you need to run this on sql 2005? I just can't get this to work.

    Oh nuts. This is the 2005 forum. Those are 2008 DMOs.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 4 posts - 1 through 3 (of 3 total)

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