String concatenation formatting

SSMS 18.1, SQL Prompt 9.5.10. When concatenating strings, it'd be nice to align the "+" signs on a new line. For example, using the attached format file, I get the following, and the indentation increases with each concatenation, reaching extremes:

SELECT CASE
           WHEN Col = 1
               THEN 'Col 1'
           ELSE ''
           END + CASE
                     WHEN Col = 2
                         THEN 'Col 2'
                     ELSE ''
                     END + CASE
                               WHEN Col = 3
                                   THEN 'Col 3'
                               ELSE ''
                               END + CASE
                                         WHEN Col = 4
                                             THEN 'Col 4'
                                         ELSE ''
                                         END AS ConcatStr
   FROM #Test;

But what I'd like to get is:

SELECT CASE
           WHEN Col = 1
               THEN 'Col 1'
           ELSE ''
           END
      + CASE
           WHEN Col = 2
               THEN 'Col 2'
           ELSE ''
           END
      + CASE
           WHEN Col = 3
               THEN 'Col 3'
           ELSE ''
           END
      + CASE
           WHEN Col = 4
               THEN 'Col 4'
           ELSE ''
           END AS ConcatStr
   FROM #Test;

Is this possible? If not I'd like to submit a feature request.

Thanks.
Tagged:

Answers

Sign In or Register to comment.