Export (0) Print
Expand All

SQL Pane

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. To open the SQL pane, first open Query and View Designer (with a database object selected in Server Explorer, from the Database menu click New Query). Then from the Query Designer menu point to Pane and click SQL.

In the SQL pane you can:

  • Create new queries by entering SQL statements.

  • Modify the SQL statement created by the Query and View Designer based on settings you make in the Diagram and Criteria panes.

  • Enter statements that take advantage of features specific to the database you are using.

NoteNote

Be sure you know the rules for identifying database objects in the database you are using. For details see the documentation for you database management system.

NoteNote

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 Visual Studio Settings.

You can edit the current query directly in the SQL pane. When you move to another pane, the Query and View Designer automatically formats your statement, and then changes the Diagram and Criteria panes to match your statement.

If your statement cannot be represented in the Diagram and Criteria panes, and if those panes are visible, Query and View Designer displays an error and then offers you two choices:

  • Ignore the fact that the statement can not be represented in the Diagram and Criteria panes.

  • Undo the change that can not be represented and revert to the most recent version of the SQL statement.

If you choose to ignore the fact that the statement can not be represented in the Diagram and Criteria panes, the Query and View Designer dims the other panes to indicate that they no longer reflect the contents of the SQL pane.

You can continue to edit the statement and execute it as you would any SQL statement.

NoteNote

If you enter an SQL statement, but then make further changes to the query by changing the Diagram and Criteria panes, the Query and View Designer rebuilds and redisplays the SQL statement. In some cases, this action results in an SQL statement that is constructed differently from the one you originally entered (though it will always yield the same results). This difference is particularly likely when you are working with search conditions that involve several clauses linked with AND and OR.

Community Additions

ADD
Show:
© 2014 Microsoft