Press "Enter" to skip to content

Refreshing Views After DDL Changes

Eduardo Pivaral shows how you can refresh the metadata for a view in SQL Server after one of its underlying tables or functions changes:

So we proceed to execute an alter view over the first view:

ALTER VIEW dbo.[vi_invoices_received_by]
as [Received by],
COUNT(InvoiceID) as [# of Invoices],
FROM Sales.Invoices
GROUP BY ConfirmedReceivedBy, CustomerID;

So we should now be able to see the updated column names on the second view, right? 

but if you execute the view again, you will obtain the same results as before:

Read on to see what’s gone wrong and how you can fix it.