Is there a free SQL formatting library for .NET?

I was looking for a free library / source code for long formatting of SQL queries, preferably in .NET. Even after looking for some answers here on SO, I'm almost at the point where I am ready to believe that nothing like this exists.

The closest I found, a project called sqlformat does not seem to be active, and it does not even support a working subset of SQL functions for formatting.

Are there any free open source SQL formatting libraries out there? I do not want a canned product, since I need to integrate this functionality into the tool that I create. Web services are also unacceptable since the ones I found as T-SQL Tidy did not prove to be very reliable.

+7
c # sql formatting
source share
3 answers

I don’t know about the free version, but there is only $ 100 here, and you can try it for 60 days (select the API version).

http://www.dpriver.com/buynow.php

It's not free, but at $ 100, it's probably less than 2 hours of your time trying to find / integrate free

+3
source share

I started the open source .Net 2.0 formatting library a couple of months ago, and now it's officially "v1 Done", without any known problems: http://www.architectshack.com/PoorMansTSqlFormatter.ashx

I also created an online SQL formatting service (for example, SQLTidy and several others, except that the formatting library that manages it is open source and fully functional): http://poorsql.com/

Sorry to be so late, but hopefully this helps someone else. Of course, any feedback would be great!

PLEASE NOTE: AGPL is licensed and therefore not suitable for integration into commercially licensed / distributed applications; but for any internal processes (continuous integration / quality control of the source) this should be good.

(Edit: updated library status)

+12
source share

I know this is an old post, but there were not many good answers. I had the same question and found this solution for VB6 on VBForums by si_the_geek - one of their super moderators.

VB Forums Topic for formatting SQL Select (VB6)

Working with VB6 and VB.NET, it was easy to convert. There is a VB.NET link at the bottom of the stream, or you can get to it right here:

VB.NET SQL Formatter

You can be able to convert this to C # using one of the online conversion tools without any problems.

We will warn, however, that the library is not commercial code β€” it works very well for fairly simple SELECTs. For a complex SQL statement with several subselections, I found errors in the resulting SQL.

Best wishes,

David

ps. Oh yes ... it's FREE! :)

+2
source share

All Articles