Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a free SQL formatting library for .NET?

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.

like image 537
Ed Altorfer Avatar asked Jul 26 '10 15:07

Ed Altorfer


1 Answers

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)

like image 106
Tao Avatar answered Sep 24 '22 14:09

Tao