Deleting a View

Creating and Maintaining Databases

Creating and Maintaining Databases

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 reference objects expected by any objects dependent on the new view, queries using the dependent objects fail when executed. For example, a view my_view that retrieves all columns from the authors table in the pubs database is deleted and replaced by a new view called my_view that retrieves all columns from the titles table instead. Any stored procedures that reference columns from the underlying authors table in my_view now fail because those columns are replaced by columns from the titles table instead.

To delete a view

Transact-SQL