Not possible to proper format a MERGE statement
mspiegel
Posts: 3
Not possible to proper format a MERGE statement.
Please see following snippet:
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
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
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.
Actually the MERGE statements exists in SQL Server since 2008.
Cheers