May 2006
Intermediate to advanced
536 pages
15h 13m
English
When you create a view, SQL Server stores metadata information describing the view, its columns, security, dependencies, and so on. Schema changes in underlying objects are not reflected in the view’s metadata information. After applying such schema changes, it’s a good practice to refresh the view’s metadata information using the sp_refreshview stored procedure so that the changes will be reflected in the view.
To demonstrate what can happen when you make schema changes and don’t refresh the view’s metadata information, first run the following code, which creates the table T1 and the view V1:
USE tempdb; GO IF OBJECT_ID('dbo.V1') IS NOT NULL DROP VIEW dbo.V1; GO IF OBJECT_ID('dbo.T1') IS NOT NULL DROP TABLE dbo.T1; GO CREATE TABLE ...Read now
Unlock full access