In this step by step SQL Tutorial I will show you how to use SQL DROP VIEW statement. For the purpose of this tutorial I will use SQL Server Management Studio 2012.
You might find this tutorial if:
- You are new to SQL and DROP VIEW statements
- You would like to find out how to perform DROP VIEW using interface and T-SQL script
- You are preparing for Microsoft Certification and DROP is not what you have used before
SQL DROP View is used to permanently remove view from database.
Below I show you how to remove view from database using SSMS interface and using T-SQL.
In the Object Explorer I open required database in this case it is AdventureWorksDW2012 then I expand views folder and find view which I want to remove. In this example it is vTest view.
Below I will show you how to delete (DROP) view from database using Object Explorer in SSMS 2012.
I open Object Explorer, AdventureWorksDW2012 database and from Views folder I right click dbo.vTest.
From drop down box I select Delete.
In the Delete Object window I click OK.
This time I will show you how to drop view using T-SQL
Create new query and make sure that correct database is selected on the database drop down box on the tool bar.
SYNTAX: DROP VIEW ViewName
The syntax is very simple and below is my sample which I executed using Execute button.
Object explorer sometimes will not refresh the database.
You can see that there is no dbo.vTest in AdventureWorksDW2012 database.
I hope that help