How to recompile the view??

  • Hi,

    How to refresh the view automatically, when the table to which it depends got altered.

    That is, if we are adding a new column in the table, then it should be reflected in the view automatically. How to do that?

    Example:

    Create table Check_Table

    (

    col1 varchar,

    col2 varchar

    )

    create view Check_Table_VW as

    select * from Check_Table

    If we are adding one more column 'Col3', then it should be reflected in the view if you go for

    select * from Check_Table_VW

    How to do this with out dropping and recreating the View?

  • Try this: exec sp_refreshview @viewname = 'name of view'

  • Thanks...its working fine..

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

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