How can we help you today? How can we help you today?

Missing spaces after parentheses

  • SQL Prompt version: 10.14.4.4865
  • SQL Server Management Studio version: 19.2.56.2
  • SQL Server Version:
    • Microsoft SQL Azure (RTM) - 12.0.2000.8
    • Microsoft SQL Server 2022 (RTM-GDR) (KB5029379) - 16.0.1105.1 (X64)
  • Database Compatibility Level: 160
  • Active Style: Default

Before formatting

SELECT '1' COLLATE DATABASE_DEFAULT AS a,
       SPACE(2) COLLATE DATABASE_DEFAULT AS b,
       TRIM('3') COLLATE DATABASE_DEFAULT AS c,
       STRING_AGG('4', '5') WITHIN GROUP(ORDER BY NEWID()) AS d;
  • This is the expected result

After formatting

SELECT '1' COLLATE DATABASE_DEFAULT AS a,
       SPACE(2)COLLATE DATABASE_DEFAULT AS b,
       TRIM('3')COLLATE DATABASE_DEFAULT AS c,
       STRING_AGG('4', '5')WITHIN GROUP(ORDER BY NEWID()) AS d;
  • Notice the missing spaces after the parentheses
orderbynewid
0

Comments

2 comments

  • Ben_P
    Hi there,

    Thank you for your post. 

    You would need to create a new format style and then, under the "Function Calls" section, check the option to include a whitespace after parentheses.


    Ben_P
    0
  • orderbynewid
    Thank you; that works in this specific case. I was not aware of that option and would have thought that "Add a space after parentheses" would be the default behavior. The result, when using the defaults, looks non-standard to me.
    orderbynewid
    0

Add comment

Please sign in to leave a comment.