The importance of well formatted SQL

Everyone knows the importance of well formatted code in whatever language and I don’t think I’ll have to convince anyone on that point.  But today I have a situation where there are SQL statements saved in a field inside a database table.  These statements are not just simple SELECT statements but are more like what would constitute a small stored procedure.  Much to my disappointment, these statements are stored as single lines of text making any modifications to it become an endless repetition of  TAB, TAB, ENTER, TAB, TAB, ‘TAB, ENTER, TAB, TAB, ‘TAB, ENTER, TAB, TAB, ‘TAB, ENTER, TAB, TAB, ‘TAB, ENTER.  You get the picture…

I know that there are some SQL Management studio add-ins that can take an SQL statement and format it automatically but my situation at this particular client is that I cannot install anything on the development PC and so I have to rely on web-based stuff a lot.

After a quick look around the Web, I stumbled on this web-based SQL formating tool that does the job very well so I thought I’d share!

http://sqlserverlearner.com/online-tools/tsql-code-formatter

Do you know of any other tools that can do the job? Preferably non-web based and no installation required. Please share with me in the comments below.

Advertisements

Posted on June 4, 2012, in SQL and tagged , . Bookmark the permalink. 1 Comment.

  1. Another online sql formatting tool is http://www.dpriver.com/pp/sqlformat.htm It’s neat in that you can choose the database like Oracle,SQL Server and so on..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: