Reflect in the view after Edited or Newly Added column of a Table

After changed the name or add new column in the table, that changes would not reflect in the view if that field used in that view.
For that you just run this system stored procedure with view name as parameter rather open the view and update it.

Sp_refreshview yourviewname

For an Example:
I am using Table_A, Table_B and View_C





In the View C I have used Table A and Table B.




After created the View C I added one more column call Status in the Table A and run the View C, you would not see that newly added column as view have not been refreshed yet as shown below.



For this you can simply update the view just using the above stored procedure as shown below,

Sp_refreshview View_C

After run the script you can able to see that added column in the view as shown below,

Comments

Popular posts from this blog

SQL SERVER – TRIM() Function – UDF TRIM()