SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
[9.0.176 Pro] - Trailing vs leading comma formatting

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
[9.0.176 Pro] - Trailing vs leading comma formatting
Author Message
Mindflux



Joined: 25 May 2013
Posts: 616
Country: United States

Post [9.0.176 Pro] - Trailing vs leading comma formatting Reply with quote
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:

Code:

SELECT 'Q' + CAST(DATEPART(QUARTER, GETDATE()) AS VARCHAR(1)) AS Quarter


Leading:
Code:

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:

Code:

SELECT CONVERT(VARCHAR(50) ,GETDATE() ,101)

Thu Oct 27, 2016 12:32 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6501

Post Reply with quote
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 View user's profile Send private message
Mindflux



Joined: 25 May 2013
Posts: 616
Country: United States

Post Reply with quote
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 View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
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


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.