Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Adding Indentation

Query Editor allows you to indent large sections of code with a single step, and you can change the amount of the indentation.

  1. On the toolbar, click New Query.

  2. Create a second query that selects the ContactID, MiddleName, and Phone columns from the Contact table of the Person database. Place each column on a separate line so the code looks like this:

    -- Search for a contact
    SELECT 
    ContactID,
    FirstName, 
    MiddleName, 
    LastName, 
    Phone
    FROM Person.Contact
    WHERE LastName = 'Sanchez';
    GO
    
  3. Select all text from ContactID to Phone.

  4. On the SQL Editor toolbar, click Increase Indent to indent all the lines at once.

  1. On the Tools menu, click Options.

  2. Expand Text Editor, expand All Languages, and click Tabs, and set indentation values as appropriate. Note that you can change the size of the indent as well as the size of tabs, and whether tabs are converted to spaces.

    Appearance of the Tabs dialog box
  3. Click OK.

Community Additions

ADD
Show:
© 2015 Microsoft