Code and Text Editor

The Code and Text Editor is a word processing tool for entering, displaying, and editing code or text. It is called the Query Editor, the Text Editor, or the Editor, based on its content. If it contains only text without an associated language, it is referred to as the Text Editor. If it contains source code that is associated with a language, it is referred to as the Query Editor. When you are referring to a particular type of Query Editor, the code type is added to the name, for example, the Database Engine Query Editor or the MDX Query Editor.

Features

  • Code Pane
    The area where you enter your code text. It contains the statement builder features available for your language.

    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.

  • Selection Margin
    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 on the General page of the Text Editor folder in the Options dialog box.

  • 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.

  • Line Numbering
    Displays line numbers to the left of the text or code in the Editor. Line numbering is turned on from the Tools, Options dialog box, on either the Text Editor, All Languages, General page, or on a specific editor page.

  • Word Wrap
    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.

  • IntelliSense
    In the Editors, on the Edit menu, point to IntelliSense, to view the Microsoft IntelliSense options. For more information about IntelliSense, see Using IntelliSense.

  • Code Outlining
    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.

  • Debug
    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. The Transact-SQL debugger in the Database Engine Query Editor is the only debugger in SQL Server Management Studio.

  • Status Bar
    Displays system information that is associated with the Query Editor window, such as which instance the Query Editor is connected to.

    In the Database Engine Query Editor, the status bars can be color coded to indicate which server the window is connected to. When you create a server entry in the Object Explorer pane, you can click Options on the Connect to Server dialog box to specify the color of the status bar for that server. When you create a registered server entry in the Registered Servers pane, you can click the Use custom color check box on the Connection Properties tab to specify the color of the status bar.

    When you click New Query on the toolbar or right-click the server entry and select New Query, the status bar displays the color that is defined for the associated server. If you open a Query Editor window by clicking the File menu, and then clicking New Database Engine Query, you can then use the Connect to Server dialog box to specify a color.