Options

Not possible to proper format a MERGE statement

mspiegelmspiegel Posts: 3
edited May 28, 2013 1:15PM in SQL Prompt Previous Versions
Not possible to proper format a MERGE statement.

Please see following snippet:
MERGE [X] AS L
    USING 
        (
          SELECT
                [X]
            FROM
                [X]
            WHERE
                [X] = X
        ) AS SRC
    ON L.ID = SRC.ID
    WHEN MATCHED 
        THEN UPDATE
            SET 
                X.[X] = 'X'
    WHEN NOT MATCHED 
        THEN
INSERT
                
          (
            [Col1],
            [ColX]
          ) VALUES
                (
                  1,
                  X
                );

1) The INSERT keyword has no indent
2) Between INSERT keyword and the first parenthese is one line break too much
3) The VALUES keyword is not on a new line

Comments

  • Options
    Thank you for your post.

    I believe that MERGE is a new feature for SQL Server 2012. While SQL Prompt does support this version, it does not yet support all the new features. So I believe that this is why you are seeing odd behaviour.

    I have therefore logged a report on our bug tracking system for the development team to take a look at.
  • Options
    Thanks for the info.

    Actually the MERGE statements exists in SQL Server since 2008.


    Cheers
Sign In or Register to comment.