How to: Open the Query and View Designer

The Query and View Designer opens when you open the definition of a view, show the results for a query or view, or create or open a query. It consists of four separate panes:

  • The Diagram pane presents a graphic display of the tables or table-valued objects you have selected from the data connection. It also shows any join relationships among them.

  • The Criteria pane allows you to specify query options — such as which data columns to display, how to order the results, and what rows to select — by entering your choices into a spreadsheet-like grid.

  • You can use the SQL pane to create your own SQL statement, or you can use the Criteria pane and Diagram pane to create the statement, in which case the SQL statements will be created in the SQL pane. As you build your query, the SQL pane automatically updates and reformats to be easily read.

  • The Results pane shows the results of the most recently executed Select query. (The results of other query types are displayed in message boxes.)

  • These panes are useful for working with both queries and views.

  • When you open a view or query some or all of the panes open with it. Which ones open depend on the settings in the Options dialog box and what database management system you're connected to. The default is that all four open.

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 open the Query and View Designer for a view (Microsoft SQL Server only)

  1. In Server Explorer, select the view you want to open.

  2. From the Database menu click Open View Definition or Show Results.

    If you chose Open View Definition, the Query and View Designer panes open as dictated by the options selected in the Options dialog box. If you chose Show Results, only the Results pane opens by default.

To open the Query and View Designer for an existing query

  1. In Project Explorer, expand the Queries folder.

  2. Double-click the query you want to open.

    The Query and View Designer panes open as dictated by the options selected in the Options dialog box.

To specify which panes open by default (Microsoft SQL Server)

  1. From the Tools menu, click Options.

  2. Expand the Visual Database Tools node and click Query/View Designer.

  3. Under Panes shown by default, check the panes you want to open whenever a query or view is opened.

See Also

Concepts

Query and View Designer Tools

Other Resources

Designing Queries and Views

Understanding Visual Database Tools