Microsoft Docs

Home Search

DROP VIEW (Transact‑SQL)

The DROP VIEW statement removes an existing view from the database.

Syntax

DROP VIEW [ IF EXISTS ] { schema_name . } view_name [ ,...n ]

Parameters

ParameterDescription
IF EXISTSPrevents an error if the view does not exist.
schema_nameThe schema that contains the view.
view_nameThe name of the view to be dropped.
,...nAllows multiple views to be dropped with a single statement.

Remarks

Example

-- Drop a single view
DROP VIEW dbo.EmployeeView;
 
-- Drop multiple views with IF EXISTS
DROP VIEW IF EXISTS dbo.SalesView, dbo.InventoryView;
 
-- Verify removal
SELECT name FROM sys.views WHERE name = N'EmployeeView';

Related Topics