Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Deleting a View

After a view has been created, you can delete the view if it is not needed, or if you want to clear the view definition and the permissions associated with it. When a view is deleted, the tables and the data upon which it is based are not affected. Any queries that use objects that depend on the deleted view fail when they are next executed, unless a view with the same name is created. However, if the new view does not contain columns expected by any objects dependent on the new view, queries that use the objects that depend on the view fail when executed. For example, a view my_view that retrieves all columns from the HumanResources.Employee table in the AdventureWorks2008R2 database is deleted and replaced by a new view called my_view. This view retrieves all columns from the Production.Product table instead. Any stored procedures that reference columns from the underlying Employee table in my_view now fail because those columns no longer appear in the view. They are replaced by columns from the Product table instead.

To delete a view

DROP VIEW (Transact-SQL)

Concepts

Creating Stored Procedures (Database Engine)
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.