However, quite a few times either due to laziness or due to time constraints, many developers do not format the queries properly. This makes the queries less readable and difficult to maintain.
I came across a really cool tool few months back and wanted to share the same with broader audience, but missed many times due to various distractions. And today finally I decided to post it on my blog :-)
Here is a tool called Instant SQL Formatter which is really cool, easy to use, pretty powerful and can format your T-SQL queries in seconds. Many of you might already be knowing about this tool, since this has been in the market for quite some time now. However I have presented few of the benefits and other details so that people who do not know about this can get benefited. Here is a screenshot of the online version of the Instant SQL Formatter.
Here are few cool features of Instant SQL Formatter:
- Supports queries from databases like MS Access, DB2, Microsoft SQL, MySQL, Oracle / PLSQL and other Generic queries.
- Supports various output formats like Text, HTML, Java, C#, VB.Net, XML and many more.
- Gives control over how you want to format Keywords (Uppercase, Lowercase, InitCap, Unchanged), Identifiers (Uppercase, Lowercase, InitCap, Unchanged, Init cap each word), Functions (Uppercase, Lowercase, InitCap, Unchanged) etc.
- Formats 100's of lines of lines of code in just few 10's of seconds.
Guess what, the best thing I like about Instant SQL Formatter is its ability to output formatted T-SQL code in Text format along with HTML format, which bloggers like me can use to embed code into blog posts :-)
Apart from the Online Version, here are few other Versions / Add-Ins of Instant SQL Formatter:
- Instant SQL Formatter - Desktop Version
- Instant SQL Formatter - Add-In for Visual Studio
- Instant SQL Formatter - Add-In for SQL Server Management Studio (SSMS) (More on SSMS Shortcuts here)
This is a real time saver tool and is worth giving a try.
Here are few of the most important advantages of writing well formatted T-SQL queries:
Here are few of the most important advantages of writing well formatted T-SQL queries:
- Makes the query readable and makes it look cleaner.
- Easy to maintain due to high readability.
- Using same set of formatting rules / standards across modules / projects ensures consistency.
And as always, for any comments / suggestions, please leave a comment below.
This post first appeared on MyTechnoBook - Datta's Technical Notes..!!, please read the originial post: here