Cool SQL formatter tool
- by AndyScott
I have to deal with all types of code that was written by people from different organizations, different countries, using different languages, obviously standards are different across these sources. One of the biggest headaches that I ahve come across is how people differ in the formatting of their SQL statements, specifically stored procs. When you regularly get over 500 lines in a sproc, if the code is not formatted correctly, you can get lost trying to figure out where one nested BEGIN begins, and another nested END ends. One of my co-workers showed me this site today that does a pretty damn good job of making sense of that type of code: http://www.dpriver.com/pp/sqlformat.htm.
This is a free website that offers a box to enter your nasty code, and click "Format SQL" and have it clean it for you. I am sure that there are situations where this may not work, but given the code that I have been working with recently, it does a really good job. There is a pay version with more options, including VS add-in, desktop component (with quickkeys to clean text in programs like notepad), the ability to output in HTML, and other stuff. Heck, I watched a demo where the purchased version will take formatted SQL code and turn it into a generic Stringbuilder object embedded in a formatted.
Yes, this seems like a shameless plug, but no, I have no relation/knowledge of anyone involved in the development of this product, it just seems useful. Either way, I recommend checking out the free version.