 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
Mindflux
Joined: 25 May 2013 Posts: 847 Country: United States |
|
[9.0.176 Pro] - Trailing vs leading comma formatting |
|
I've recently switched to leading commas in my formatting rules..
Though I think there may be an unintended (and weird looking) consequence to this.
Trailing:
 |
 |
SELECT 'Q' + CAST(DATEPART(QUARTER, GETDATE()) AS VARCHAR(1)) AS Quarter
|
Leading:
 |
 |
SELECT 'Q' + CAST(DATEPART(QUARTER ,GETDATE()) AS VARCHAR(1)) AS Quarter
|
I get the idea behind it for stacked column selection, but for stuff wrapped in parenthesis or inside a function it doesn't make sense to me to format those the same way and also for me, makes it harder to read. FYI I'm talking about the comma following QUARTER in the datepart func.
The more commas in the function the odder it gets to read:
 |
 |
SELECT CONVERT(VARCHAR(50) ,GETDATE() ,101) |
|
|
Thu Oct 27, 2016 12:32 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
You can setup a separate formatting pattern for things within parenthesis, there is a predefined rule for that labeled as (...). Hope that works for you.
|
|
Thu Oct 27, 2016 1:30 pm |
|
 |
Mindflux
Joined: 25 May 2013 Posts: 847 Country: United States |
|
|
|
That seems to do it. What's odd is the default is leading commas, but that snippet still had trailing commas until I changed my format preference for commas itself?
|
|
Thu Oct 27, 2016 2:02 pm |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|