Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
How to: Create Delete Queries (Visual Database Tools)

How to: Create Delete Queries (Visual Database Tools)

You can delete all rows in a table by using a Delete query.

NoteNote

Deleting all rows from a table clears the data in the table but does not delete the table itself. To delete a table from a database, right-click the table in Object Explorer and click Delete.

When you create a Delete query, the Criteria pane changes to reflect the options available for deleting rows. Because you do not display data in a Delete query, the Output, Sort By, and Sort Order columns are removed. In addition, the check boxes next to the column names in the rectangle representing the table or table-valued object are removed because you cannot specify individual columns to delete.

If the Query and View Designer can't delete one or more of the rows none of them will be deleted and you will receive a message telling you which row(s) contain information that can't be deleted from the database.

Caution noteCaution

You cannot undo the action of executing a Delete query. As a precaution, back up your data before executing a Delete query.

To create a Delete query

  1. Add the table to delete rows from to the Diagram pane.

  2. From the Query Designer menu, point to Change Type, and then click Delete. Note   If more than one table is displayed in the Diagram pane when you start the Delete query, the Query and View Designer displays the Delete Table Dialog Box to prompt you for the name of the table to delete rows from.

When you execute the Delete query, no results are reported in the Results Pane. Instead, a message appears indicating how many rows were deleted.

Community Additions

ADD
Show:
© 2015 Microsoft