Поделиться через


How to: Delete Database Objects

To delete a database object from a database project, you delete the file that contains the object definition from Solution Explorer. After you delete one or more objects from a database project, you must build and deploy the changes to your database server. You can also delete or comment out the definition of the objects in the file. You can also remove objects temporarily from the project. For more information, see How to: Exclude Files from a Database Project.

Deleting Database Objects

To delete the file that contains an object definition from a database project

  1. In Solution Explorer, click the file that represents the object that you want to delete.

  2. On the Edit menu, click Delete. You can also click the object and press the DELETE key.

    A confirmation dialog box appears.

  3. In the confirmation dialog box, click OK.

    The object is deleted from the database project in both Solution Explorer and Schema View. If the database project is under version control, when you delete the object, the project file will be checked out. If the object you deleted had child objects, such as indexes or keys on a table, the child objects will appear in the Orphaned Objects folder in Schema View. Errors will appear in the Error List indicating that the parent object cannot be found.

    For the change to be reflected on the database server, you must build and deploy your changes. For more information, see How to: Build a Database Project to Generate a Compiled Schema (.dbschema) File.

See Also

Tasks

How to: Create a Database Object

How to: Modify Database Objects

Concepts

Build and Deploy Databases to an Isolated Development Environment

Creating and Modify Database and Server Objects