Is there a Tidy for SQL?
formatting, sql, sql-server, ssms
Solution
Two options that seem to be missing, and I think are both more appropriate than most options listed so far:
Poor Man's T-SQL Formatter / poorsql.com (free, open-source, SSMS add-in, command line formatter, full DDL/DML script formatting, and I'm the author/maintainer, so I get to put it first :))
T-SQL Tidy (free, SSMS Add-In, full DDL/DML script formatting, apparently an SQL Server 2008 R2 add-in can do offline formatting also now - but not open-source?)
I believe either of these makes more sense than any of the previous answers because the other options provided are:
- Online-only (instant SQL formatter)
- Trialware / commercial software (SQL pretty printer)
- Don't format (SSMS tools pack, the accepted answer)
- Don't handle full T-SQL properly (CPAN module, SQL-talk prettifier)
- Incomplete, only handle some statements (SqlFormat project)
Problem
I'm looking for a tool that that I can use to clean up (formatting, tabs, etc.) my stored procedures and views. Is there anything like HTML Tidy, but for SQL which is free/open source?