| title | Delete Views | Microsoft Docs | ||||
|---|---|---|---|---|---|
| ms.custom | |||||
| ms.date | 06/13/2017 | ||||
| ms.prod | sql-server-2014 | ||||
| ms.reviewer | |||||
| ms.technology | table-view-index | ||||
| ms.topic | conceptual | ||||
| helpviewer_keywords |
|
||||
| ms.assetid | 6823c7f8-06ca-4bda-8482-7092f03d52a0 | ||||
| author | stevestein | ||||
| ms.author | sstein | ||||
| manager | craigg |
You can delete (drop) views in [!INCLUDEssCurrent] by using [!INCLUDEssManStudioFull] or [!INCLUDEtsql]
-
When you drop a view, the definition of the view and other information about the view is deleted from the system catalog. All permissions for the view are also deleted.
-
Any view on a table that is dropped by using
DROP TABLEmust be dropped explicitly by usingDROP VIEW.
Requires ALTER permission on SCHEMA or CONTROL permission on OBJECT.
-
In Object Explorer, expand the database that contains the view you want to delete, and then expand the Views folder.
-
Right-click the view you want to delete and click Delete.
-
In the Delete Object dialog box, click OK.
[!IMPORTANT]
Click Show Dependencies in the Delete Object dialog box to open the view_nameDependencies dialog box. This will show all of the objects that depend on the view and all of the objects on which the view depends.
-
In Object Explorer, connect to an instance of [!INCLUDEssDE].
-
On the Standard bar, click New Query.
-
Copy and paste the following example into the query window and click Execute. The example deletes the specified view only if the view already exists.
USE AdventureWorks2012 ; GO IF OBJECT_ID ('HumanResources.EmployeeHireDate', 'V') IS NOT NULL DROP VIEW HumanResources.EmployeeHireDate; GO
For more information, see DROP VIEW (Transact-SQL).