MS SQL Server Concepts and Programming Question:
Download Job Interview Questions and Answers PDF
How To Drop Existing Views from a Database in MS SQL Server?
Answer:
If you don't need a specific view any more, you can use the DROP VIEW statement to delete it from the database. The following tutorial exercise shows you how to delete the view, ggl_links_view:
USE GlobalGuideLineDatabase;
GO
SELECT * FROM sys.views;
GO
name object_id schema_id type type_desc
--------------- ----------- ---------- ---- ----------
ggl_links_view 1189579276 1 V VIEW
ggl_links_top 1205579333 1 V VIEW
(2 row(s) affected)
DROP VIEW ggl_links_view;
GO
SELECT * FROM sys.views;
GO
<pre>name object_id schema_id type type_desc
--------------- ----------- ---------- ---- ----------
ggl_links_top 1205579333 1 V VIEW
(1 row(s) affected)</pre>
USE GlobalGuideLineDatabase;
GO
SELECT * FROM sys.views;
GO
name object_id schema_id type type_desc
--------------- ----------- ---------- ---- ----------
ggl_links_view 1189579276 1 V VIEW
ggl_links_top 1205579333 1 V VIEW
(2 row(s) affected)
DROP VIEW ggl_links_view;
GO
SELECT * FROM sys.views;
GO
<pre>name object_id schema_id type type_desc
--------------- ----------- ---------- ---- ----------
ggl_links_top 1205579333 1 V VIEW
(1 row(s) affected)</pre>
Download MS SQL Server Interview Questions And Answers
PDF
Previous Question | Next Question |
How To See Existing Views in MS SQL Server? | How To Get a List of Columns in a View using "sys.columns" in MS SQL Server? |