Query and Text Editors (SQL Server Management Studio)
Applies To: SQL Server 2016
You can use one of the SQL Server Management Studio editors to interactively edit and test a Transact-SQL, MDX, DMX, or XML/A script, or to edit an XML or plain text file. Each editor is supported by a language-specific service that colors keywords, and checks for syntax and usage errors. The Database Engine Query Editor includes a Transact-SQL debugger that you can use to help fix problems in Transact-SQL code.
The four editors in Management Studio share a common architecture. The text editor implements the base level of functionality, and can be used as a basic editor for text files. The other three editors, or query editors, extend this base of functionality by including a language service that defines the syntax of one of the languages supported in SQL Server. The query editors also implement varying levels of support for editor features such as IntelliSense and debugging. The query editors include the Database Engine Query Editor for use in building scripts containing Transact-SQL and XQuery statements, the MDX editor for the MDX language, the DMX editor for the DMX language, and the XML/A editor for the XML for Analysis language.
All of the editors in Management Studio share these components:
The area where you enter your queries or text. In the query editors, it contains the statement builder features available for your language. The text editing environment supports find and replace, bulk commenting, and custom fonts and colors.
You can set options that affect the behavior of text in the code pane as it relates to indenting, tabbing, dragging and dropping of text, and so forth. Query windows can be configured to operate as either tabs in the document window, or in separate documents.
A column of white space between the margin indicator bar and the code text where you can click to select lines of text. You can hide or display the selection margin.
Horizontal and Vertical Scroll Bars
Allows you to scroll the code pane horizontally and vertically so that you can view the code that extends beyond the viewable edges of the code pane.
Displays line numbers to the left of the text or code in the Editor. You can navigate to specific line numbers.
Displays long lines of text or code as multiple lines, enabling you to see all the text on the line. Word wrap does not affect the way text appears when it is executed or printed. Word wrap is turned on from the Tools, Options dialog box, on either the Text Editor, All Languages, General page, or on a specific editor page.
The code editors contain these features in addition to the ones shared with the text and XML editors:
This window is used to view the results of a query. The window can display the results in grid or in text, or the results can be directed to a file. Result grids can be displayed as separate tabbed windows.
In the Editors, on the Edit menu, point to IntelliSense, to view the Microsoft IntelliSense options.
Displays different colors for each type of syntax element, which improves the readability of complex statements.
Displays code groups with outlining lines to the left of the code. Code groups can be collapsed and expanded to make it easier to review your code.
Templates are files that include the basic structure of the statements needed to create objects in a database. They can be used to speed the authoring of scripts.
Displays errors, warnings, and informational messages that are returned by the server when a script is run. The list of messages does not change until the script is run again.
Displays system information that is associated with the Query Editor window, such as which instance the Query Editor is connected to.
These components are only available in the Database Engine Query Editor:
Enables you to pause the execution of code on specific statements. You can then view data and system information to help you find errors in the code.
Displays syntax and semantic errors found by IntelliSense. The list of errors changes dynamically as you edit Transact-SQL scripts.
Displays the logical steps built into the execution plan of a Transact-SQL statement.
Displays information about the query execution grouped into categories. When Include Client Statistics is selected from the Query menu, a Client Statistics window is displayed upon query execution. Statistics from successive query executions are listed along with the average values. Select Reset Client Statistics from the Query menu to reset the average.
Templates you can use as a starting point when adding statements in the Database Engine Query Editor. You can insert the pre-defined snippets supplied with SQL Server, or add your own snippets.
Runs Transact-SQL scripts that include the set of commands supported by the sqlcmd utility. For more information, see sqlcmd How-to Topics.
|Describes how to view and use the basic features in the Database Engine Query Editor.||Database Engine Query Editor (SQL Server Management Studio)|
|Describes how to view and use the basic features in the MDX Query Editor.||MDX Query Editor (Analysis Services - Multidimensional Data)|
|Describes how to view and use the basic features in the DMX Query Editor.||DMX Query Editor (Analysis Services - Data Mining)|
|Describes how to view and use the basic features in the XML/A Editor.||XML Editor (SQL Server Management Studio)|
|Describes how to configure options for the various editors, such as line numbering and IntelliSense options.||Configure Editors (SQL Server Management Studio)|
|Describes the various ways you can open the editors in Management Studio.||Open an Editor (SQL Server Management Studio)|
|Describes how to manage the view mode, such as word wrap, splitting a window, or tabs.||Manage the Editor and View Mode|
|Describes how to set formatting options, such as hidden text or indentation.||Manage Code Formatting|
|Describes how to navigate through the text in an editor window by using features such as incremental search or go to.||Navigate Code and Text|
|Describes how to set color coding options for various classes of syntax, which makes it easier to read complex statements.||Color Coding in Query Editors|
|Describes how to use code outlining to hide parts of complex scripts that you are not currently working on.||Code Outlining|
|Describes how to drag text from one location in a script and drop it in a new location.||Drag and Drop Text|
|Describes how to do global search and replace, such as when changing column names.||Search and Replace|
|Describes how to set bookmarks in order to more easily find important pieces of code.||Manage Bookmarks|
|Describes how to print scripts or the results in a window or grid.||Print Code and Results|
|Describes how to use the sqlcmd features in the Database Engine Query Editor.||Edit SQLCMD Scripts with Query Editor|
|Describes how to use IntelliSense features such as auto-completing object names as you type them, or ensuring breakpoints are placed in valid locations.||IntelliSense (SQL Server Management Studio)|
|Describes how to use code snippets in the Database Engine Query Editor. Snippets are templates for commonly used statements or blocks, and can be customized or extended to include site-specific snippets.||Transact-SQL Code Snippets|
|Describes how to use the Transact-SQL debugger to step through code and view debugging information such as the values in variables and parameters.||Transact-SQL Debugger|
|Describes how to set custom colors for different instances of the Database Engine, and have those colors set as the background of the status bar in Database Engine Query Editor windows.||Status Bar (Database Engine Query Editor)|