Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/praetoriansentry/tsql

Transact-SQL Formatter
https://github.com/praetoriansentry/tsql

Last synced: about 7 hours ago
JSON representation

Transact-SQL Formatter

Awesome Lists containing this project

README

        

* TSQL Formatter

I use Microsoft SQL Server all the time at work. I've been having a
very difficult time finding a formatter for Transact SQL that formats
the code in a way that I like. Since I couldn't find one, I thought
it would be a good idea to write one!

It has also be quite difficult to find a good lexer / parser for
TSQL. The only one that I could find was part of the SQL Server
class library. Check [[http://technet.microsoft.com/en-us/library/microsoft.sqlserver.management.sqlparser.parser.aspx][here]] for more details.

** Screenshot

[[http://i.imgur.com/aOS0ZMl.png]]

** Future Stuff

- Add configuration support
- Properly indentation for ~AND~ and ~OR~ clauses that are nested
within parenthesis
- Add unit testing?
- For special cases like ~CREATE~, ~UPDATE~, ~DELETE~ reset the
clause stack... assuming these aren't statements.
- Making the spacing around ()'s more normal