Search code examples
sqlsql-serverformattingssms

Is there a Tidy for SQL?


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?


Solution

  • Two options that seem to be missing, and I think are both more appropriate than most options listed so far:

    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)