Friday, January 25, 2013

Align Sql script in Any Database

Scenario:
Today , while i was working with a large Stored Procedure i felt need of a way to auto align in sql server.

Approach:
 I searched for same on internet and got to know there isn't any short-key provided by Microsoft Sql server. While searching for an add-in there wasnt anything suggested by microsoft site of community provided. At the and i decided to use one of online formater and i got to know http://www.dpriver.com/pp/sqlformat.htm . It is good enough to handle most of the things.

Steps to Use:
1. Visit Link http://www.dpriver.com/pp/sqlformat.htm
2. Select Database from dropdown MSSQL
3. Copy text of a valid T-SQL script (SP or Table) needed to be formated and paste on First Text Area.
4. Check default settings at right side of page (you can leave everything as it is ) . There is one thing defiantly required to change is value in last Textbox (80 to 500 in my case). otherwise it will break one statement into multiple lines.
5. Click on Format button (First button below Text Area).
6. There is output will be displayed on second (destination) TextArea.
7. Now you can Copy Text of this TextArea and paste on you SSMS querywindow and run.

 Thanks dpriver.com for providing us this tool.

Updated: 25/10/2013
http://poorsql.com/ is also a good formater of sql script and we can use it in both ways either online or through adding Add-in to Sql server (SSMS ) and it works with only Ctrl+K,Ctrl+F. we found that is a fast way to format sql scripts.

www.ssmstoolspack.com/‎‎  , SSMS tools pack provide us a large number of functionality including formatting, running
script on different database at once, to store script change history so we can retrieve previous version of our scripts. It also include Insert script generator tool,find data in database/Table/Views and so on.
But after doing all that it makes us to compromise with speed of SSMS while i was trying it my sqlserver hanged 3 times so preferred to go with "Poorsql" instead of "SSMS tool pack".



Happy Living...
Happy Concepts...
Happy Programming...


2 comments:

  1. Here is one more great service for beautifying SQL code

    Online SQL Formatter

    ReplyDelete
  2. I have tried several tools to format my SQL code, but my favorite is SQL Formatter by Devart. This tool is available online absolutely free and it makes my code better and speeds up writing it.
    Online SQL Formatter

    ReplyDelete