How to: Remove Tables from Queries

You can remove a table β€” or any table-valued object β€” from the query.

Note

Removing a table or table-valued object does not delete anything from the database; it only removes it from the current query. For details about removing a table from a database, see How to: Delete Tables from a Database.

Note

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Customizing Development Settings in Visual Studio.

To remove a table or table-structured object

  • In the Diagram Pane, select the table, view, user-defined function, synonym, or query, and then press DELETE, or right-click the object and then choose Remove in the resulting dialog box. You can select and remove multiple objects at one time.

    –or–

  • Remove all references to the object in the SQL Pane.

When you remove a table or table-valued object, the Query and View Designer automatically removes joins that involve that table or table-valued object and removes references to the object's columns in the SQL pane and Criteria Pane. However, if the query contains complex expressions involving the object, the object is not automatically removed until all references to it are removed.

See Also

Tasks

How to: Add Tables to Queries

How to: Create Table Aliases

Other Resources

Specifying Search Criteria

Summarizing Query Results

Performing Basic Operations with Queries