I've been looking for a free library/source code to format SQL queries, preferably in .NET, for quite a while. Even after searching some of the responses here on SO, I'm almost at the point where I'm willing to believe that nothing like this exists.
The closest thing I've found, a project called sqlformat, does not seem to be active, nor does it really even support a workable subset of SQLs features for formatting.
Are there any free or open source SQL formatting libraries out there? I don't want a canned product, as I need to integrate this functionality into a tool I'm building. Web services aren't acceptable either, since the ones I have found like T-SQL Tidy haven't proven to be very reliable.
I started an open-source .Net 2.0 T-SQL formatting library a couple of months ago, and it's now officially "v1 Done", with no known issues: http://www.architectshack.com/PoorMansTSqlFormatter.ashx
I've also set up an online SQL Formatting service (like SQLTidy and several others, except in this case the formatting library that drives it is open-source and fully-functional): http://poorsql.com/
Sorry it's so late, but hopefully this helps someone else out there. Of course, any feedback would be great!
PLEASE NOTE: It's AGPL-licensed, so not appropriate for integration into commercially licensed/distributed applications; but for any sort of internal processes (continuous integration / source control quality) it should be fine.
(Edit: Updated status of the library)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With