Removes one or more views from the current database. Any view on the dropped table (dropped by using the DROP TABLE statement) must be explicitly dropped by using DROP VIEW.
DROP VIEW {view} [,...n]
When you drop a view, the definition of the view and other information about the view is deleted from the sysobjects, syscolumns, syscomments, sysdepends, and sysprotects system tables. All permissions for the view are also deleted.
When querying through a view, Microsoft® SQL Server™ checks to make sure that all the database objects referenced anywhere in the statement exist, that they are valid in the context of the statement, and that data modification statements do not violate any data integrity rules. A check that fails returns an error message. A successful check translates the action into an action against the underlying table(s).
If the underlying table(s) or view(s) have changed since the view was originally created, it may be useful to drop and re-create the view.
For more information about determining dependencies for a specific view, see sp_depends.
For more information about viewing the text of the view, see sp_helptext.
DROP VIEW permission defaults to the view owner, and is not transferable. However, members of the db_owner fixed database role or sysadmin fixed server role can drop any object by explicitly specifying the owner in DROP VIEW.
This example removes the view titles_view .
USE pubs
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS
WHERE TABLE_NAME = 'titles_view')
DROP VIEW titles_view
GO
ALTER VIEW | sysdepends |
CREATE VIEW | sysobjects |
syscolumns | USE |
syscomments | sysprotects |