SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Semicolon Line Terminator When Formatting?

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
Semicolon Line Terminator When Formatting?
Author Message
edwinrichards



Joined: 06 Dec 2024
Posts: 2
Country: United States

Post Semicolon Line Terminator When Formatting? Reply with quote
I recently installed SQL Assistant into SSMS to test it out as an alternative to the current solution my company uses for SQL code formatting. I like the customizability of the formatting options, but I can't seem to figure out how to make it automatically insert semicolons at the end of each SQL statement. This is something that is required by my company's standards, so naturally, I looked for that option when testing out the formatting functionality. I tried messing with the formatting rules, too, and adding a semicolon in the rule doesn't seem to apply to the code when formatting. I did notice in the documentation for customizing the formatting rules that extra keywords are ignored if they do not affect the code being formatted. I wonder if the semicolon I've added is also being ignored.. Is there something I am missing for how to enable automatically including semicolon line terminators?

Thank you in advance!
Fri Dec 06, 2024 7:16 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7929

Post Reply with quote
Adding semicolons isn't a feature supported by code formatting/beautification. I can't think of any tool in the entire SQL Assistant toolset that could do that.
Fri Dec 06, 2024 9:25 pm View user's profile Send private message
edwinrichards



Joined: 06 Dec 2024
Posts: 2
Country: United States

Post Reply with quote
That's too bad.. Thanks for the response!
Mon Dec 09, 2024 11:47 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7929

Post Reply with quote
If your code has SQL statements separated by consecutive line breaks, or you use the code formatting tool first to add them where statement separation lines are missing, then perhaps you can use a simple regex based text search and replace in the next step to add semicolons, replacing consecutive line breaks with a semicolon followed by line breaks.
Mon Dec 09, 2024 9:41 pm View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2155

Post Reply with quote
Hmm... Interesting approach. I guess it would be possible to create a macro that first applies a set of formatting rules that makes every statement single-line, then use an advanced text processing rule to replace linebreaks with a semicolon + linebreak pair, and then apply another formatting rule that is more visually appealing.

My only with that is that there are some statements/keywords/whatever for which I simply cannot beat SA into submission and it always ruins the code. One such misfortune group is the UPDATE statement with multiple tables and when having a CROSS APPLY somewhere. But there are a few more. For this reason, I gave up formatting the context of the entire editor and now I only apply formatting to selected parts of the code.
Wed Dec 11, 2024 7:30 am 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.