r/SQLServer • u/Nervous_Effort2669 • Nov 08 '25
Discussion TSQL Formatting Tools
I’m a believer that consistently formatted code provides massive long term efficiencies. Sadly, I’m in the minority at the Fortune 50 company I work at.
Developers are being forced to use AI, which is fine, but the copy/paste/vibe developers refuse to go in and format to any sort of documented formatting conventions.
My question is what sort of tooling can I plug into the SDLC pipeline that will automagically format code according to prescribed guidelines?
19
Upvotes
2
u/NotMyUsualLogin Nov 09 '25
If AI is already “required” then why not use AI to reformat it?
Have a “template” of formatted queries available and tell it to reformat the developer supplied code accordingly?
Sure, there’s a risk to it bodging up, but you’re using company requirements to do it!
17
u/SirGreybush 1 Nov 08 '25
PoorSQL.com
Or a plugin on Notepad++
The issue with RedGate is that every single SSMS update the tool stops working, and due to our high security, I cannot reinstall programs at work.
With the website I run all the queries through there, especially the views, so they look uniform.
9
u/Wolf-Shade Nov 08 '25
SQLFluff
5
u/Disastrous_Fill_5566 Nov 08 '25
Redgate have a command line tool you can use to format SQL. I'm sorry that I don't know the details.
4
u/meatmick Nov 09 '25
I use sqlComplete from devart. The formatting, snippets, and query history are nice.
1
u/Codeman119 Nov 09 '25
In what manner are you being forced to use AI?
1
u/harveym42 Nov 09 '25
It isn't really true that strict consistency has these benefits. Other desirable qualities are readability, manageability, and compactness. For example if there several similar long expressions, I like it and it is more efficient for editing and spotting errors, if they are on one line each and aligned vertically , not forced to be on numerous lines each , and indented differently.
1
u/Hairy-Ad-4018 Nov 08 '25
Why are your code reviews not flagging lack of adherence to coding standards ?
1
u/stickman393 Nov 08 '25
This sounds like the worst of both worlds - being forced to use AI, and also there's a formatting gatekeeper on the team. Joy.
1
u/mainemason Nov 08 '25
My boss uses PrettyPrinter, which IIRC has a plugin for SSMS.
1
u/Ok_Inspector1565 Nov 09 '25
DevToys
1
u/Traditional_Point861 Nov 09 '25
Look at Coalesce or DBT, if your team does a lot of database development. Both are great governance, standardization and documentation.
0
u/techsamurai11 Nov 09 '25
Could you offer an example of a simple formtted vs unformatted statement? I just want to check if I'm doing well.
1
u/[deleted] Nov 09 '25
[removed] — view removed comment