Options

Formatting inconsistent with settings for INSERT INTO

NizzyNizzy Posts: 3
edited March 6, 2017 11:33AM in SQL Prompt
Hello, I am not seeing the expected formatting for INSERT INTO statements. Below I have included my settings and examples of the statements and formatting.

Am I wrong in thinking the INSERT INTO statement should be formatting the same as the SELECT statement below?



SQL Prompt version 7.4.1.603
==============================================================================================================

Format > Data statements

These options apply to SELECT, INSERT, UPDATE and DELETE statements

New lines - Place the following on a new line:
[x] First Column
[x] Each subsequent column
[x] Contents of parentheses
[x] Closing parentheses
[x] Join condition
[x] Indent subclauses
[ ] Align join condition with JOIN

Subqueries:
[ ] Place derived tables and subqueries on a single line

Indents:
[ ] Align JOIN with FROM
[x] Align SELECT with INSERT


-- this is the table and it formats correctly
CREATE TABLE #myTempTable (
      ID INT PRIMARY KEY CLUSTERED
    , Name NVARCHAR(50)
    , ThisOrThat BIT
    )

-- this is what I expected for the INSERT statement
INSERT INTO #myTempTable (
      ID
    , Name
    , ThisOrThat
    )
    VALUES
        (
              0
            , N'0'
            , 0
        )
        ,(
              1
            , N'1'
            , 1
        )

-- SELECT is working as expected with the settings
SELECT
        ID
      , Name
      , ThisOrThat
    FROM
        #myTempTable

-- this is the INSERT statement after formatting
-- it places the columns and values on a single line and wraps them if too long
INSERT INTO #myTempTable
        (ID, Name, ThisOrThat)
    VALUES
        (0, N'0', 0),
        (1, N'1', 1)

Comments

  • Options
    Harry FrankishHarry Frankish Posts: 53 New member
    Hi Nizzy

    The new formatting styles in SQL Prompt will apply a more consistent format to CREATE TABLE and INSERT INTO. This is currently an experimental feature which you can turn on by going to "SQL Prompt > Options > Labs > Experimental Features" and selecting the "Use new formatting styles" checkbox.

    We have a few known issues when formatting the VALUES clause of INSERT statements which we'll be improving in the near future.

    Please let us know if the new formatting styles help you and if you have any further feedback.

    Thanks
    Harry
Sign In or Register to comment.