III.8.5. Deleting a View

When a view is no longer needed, you might choose to remove it from the database. Views can be removed by using two methods:

  • SQL Server Management Studio (SSMS): Views can be deleted.

  • T-SQL Script: Views can be dropped.

We know it seems that one word could be used to define this simple concept of removing a view instead of both deleted and dropped. T-SQL has long used the terms dropping objects and deleting data. For example, a table or view is dropped, but rows within a table are deleted. However, in SSMS, the designers chose to use delete to remove objects.

III.8.5.1. Deleting a view using SSMS Object Explorer

To delete a HumanResources.vEmployeeViewDesigner view with the SSMS Object Explorer, follow these steps:

  1. Launch SQL Server Management Studio (SSMS).

    Choose StartAll ProgramsMicrosoft SQL Server 2008SQL Server Management Studio.

  2. On the Connect to Server screen, click Connect.

  3. Using the SSMS Object Explorer, browse to the Databases | AdventureWorks2008 | Views container.

  4. Select the HumanResources.vEmployeeViewDesigner view.

  5. Right-click the view and choose Delete.

  6. On the Delete Object dialog box, click OK.

  7. Leave SSMS open.

III.8.5.2. Dropping a view using T-SQL ...

Get Microsoft® SQL Server™ 2008 All-In-One Desk Reference For Dummies® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.