SQL 2008 : I have created a View ( select * from VW_Test1
).
This View is targeting table1 and table2.
For some reasons, i renamed these tables as table1_old and table2_old.
I have created new tables as table1 and table2 with new values.
When ever, i am executing the view it gives the same output which it gave before .. i.e) 308 rows affected.
Actually, i am expecting more rows .. Does view stores in buffer like temptable ..
or how to clear and 开发者_JS百科execute again ..? or could be some other reasons ???
From MSDN - CREATE VIEW:
If a view depends on a table or view that was dropped, the Database Engine produces an error message when anyone tries to use the view. If a new table or view is created and the table structure does not change from the previous base table to replace the one dropped, the view again becomes usable. If the new table or view structure changes, the view must be dropped and re-created.
And:
If a view is not created with the SCHEMABINDING clause, sp_refreshview should be run when changes are made to the objects underlying the view that affect the definition of the view. Otherwise, the view might produce unexpected results when it is queried.
I suggest you DROP and recreate the view.
精彩评论