How to: Delete Database Objects

How to: Delete Database Objects

To delete a database object from a database project, you can delete the object from Schema View, or you can delete the file that contains the object definition from Solution Explorer. You must follow a different process to delete table columns and the parameters of a stored procedure or function. After you delete one or more objects from a database project, you must build and deploy the changes to your database server.

Deleting Database Objects

To delete an object from a database project


  1. If Schema View does not appear, open the View menu and click Schema View.


  2. In Schema View, click the object that you want to delete.


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

    A confirmation dialog box appears.


  4. Click OK in the confirmation dialog box.

    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. Deleting an object from Schema View also deletes all child objects. For example, if you delete a table, all keys, triggers, indexes, constraints, and statistics are also deleted.

    For the change to be reflected on the database server, you must build and deploy your changes.

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. Click OK in the confirmation dialog box.

    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.

Comments

Popular posts from this blog

Google to FTS Syntax Cheat Sheet

@@rowcount

Sql Index