![SoftTree Technologies](templates/GreenTech/images/logo.gif) |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
edwinrichards
Joined: 06 Dec 2024 Posts: 2 Country: United States |
|
Semicolon Line Terminator When Formatting? |
|
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 |
|
![](templates/GreenTech/images/spacer.gif) |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7929
|
|
|
|
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 |
|
![](templates/GreenTech/images/spacer.gif) |
edwinrichards
Joined: 06 Dec 2024 Posts: 2 Country: United States |
|
|
|
That's too bad.. Thanks for the response!
|
|
Mon Dec 09, 2024 11:47 am |
|
![](templates/GreenTech/images/spacer.gif) |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7929
|
|
|
|
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 |
|
![](templates/GreenTech/images/spacer.gif) |
gemisigo
Joined: 11 Mar 2010 Posts: 2155
|
|
|
|
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 |
|
![](templates/GreenTech/images/spacer.gif) |
|
|
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
|
|
|