Format SQL code
I have been writing copious quantities of SQL lately. Some of the queries are getting really long. When I am working with Navicat it has a nice ‘SQL beautify’ feature that takes messy SQL and makes it nice and tidy. 🙂
While that features is great when using Navicat for SQL editing, sometimes I need to workdirectly with SQL Server 2008 there is no comparable feature built into Microsoft’s SQL pane. 🙁
Thankfully, with a quick copy/paste there is an online tool that can automatically format your SQL for you:
- SQL Formatter for SQL Server – free web based tool (this is the one I used)
- Poor SQL – alternative tool
PS Normally I like NotePad++ to cleanup and format HTML but it does not seem to have that feature for SQL yet, here is the closest I could get:
More links about code formatting:
http://stackoverflow.com/questions/3635460/formatting-code-within-notepad
http://stackoverflow.com/questions/7871054/notepad-eclipse-sql-code-auto-indent-option
http://stackoverflow.com/questions/401928/sql-formatter-for-sql-management-studio