Udostępnij za pośrednictwem


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 AdventureWorks 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)

See Also

Concepts

Views (Database Engine)
Modifying and Renaming a View
Creating Stored Procedures (Database Engine)

Help and Information

Getting SQL Server 2005 Assistance