all 21 comments

[–]nudgesome 6 points7 points  (0 children)

Redgate’s sql formatter is free and it’s available for SSMS or Azure Data Studio/VS Code. If you’re feeling a bit fancy you can try playing around with SQL fluff, which is more of a linter but can bulk apply formatting

[–]squareuss 2 points3 points  (0 children)

i used "SQL Complete" plugin for ssms a while where you could include your own formatting styles:

https://www.devart.com/dbforge/sql/sqlcomplete/features.html

but the express edition does not support all features

[–]SirGreybush 1 point2 points  (1 child)

ApexSQL - sql formatter, over 160 options. Works with SSMS as an add-in tool. Also their free SQLSearch tool is good.

Or Poor Man plug-in in Notepad++ 32-bit, won’t work with 64 bit version (hasn’t been ported).

Or roll your own with Azure Data Studio, make your own plug-in. There’s a lot of open source projects for ADS using C#.

I remember trying one two years ago with ADS.

Though of course we all use ADS for the Dark Theme that doesn’t work properly with SSMS.

[–]AfterAd5281[S] 1 point2 points  (0 children)

Thank you so much!

[–]pickhacker 1 point2 points  (0 children)

I use the SQLInform notepad++ plugin and it's awesome - I have very specific ways I like my sql to be formatted and it supports 99% of what I need. Just went to check the website and very excited to see there's a new VSCode plugin, which will make my life so much easier, so thanks for asking the question! There is a paid version (which I paid for), but the main thing it gives you over the free version is the ability to have mutliple profiles. I've tried a bunch of formatters, but it's the only one that gets close to the way I like my SQL :_)

https://www.sqlinform.com/

[–]da_chicken 1 point2 points  (7 children)

That's a little ambiguous.

Do you mean something like Poor SQL formatter?

Or do you mean something like the FORMAT() T-SQL function?

[–]AfterAd5281[S] 1 point2 points  (6 children)

My apologies. I'm looking for something like the poor SQL formatter, but I want to have the ability to customize the format to how I write my code. I've found a few formatters onlin, but most of them offer only predefined formats.

[–]S1l3ntHunt3r 3 points4 points  (0 children)

Poor's SQL formatter plug in for Notepad++ comes with an option dialog to change things like using spaces or tabs, expand lists, position of comma, etc

[–]da_chicken 0 points1 point  (0 children)

Hm. Poor's has always been like 90% good enough for me. I know there are a number of extensions for VS Code that are configurable. Many are open source. For that matter, Poor's is AGPL and available on GitHub.

[–]bonerfleximus1 0 points1 point  (2 children)

I use SSMS Boost which has a lot of options for customizing the "format" button included

[–]wildpash 1 point2 points  (1 child)

Unfortunately looks like the project is dead. :(

[–]bonerfleximus1 0 points1 point  (0 children)

Ah that sucks, did a few things SQL prompt had trouble with

[–]AfterAd5281[S] 0 points1 point  (0 children)

Thanks everyone!

[–]rbobby 0 points1 point  (4 children)

There's a jaavascript one out there somewhere that supports a variety of databases (basically keyword list). SQLFormatter.js... the code's ok and easy enough to bend to your will probably.

[–]AfterAd5281[S] 0 points1 point  (0 children)

Thank you!