Need a tool to automatically indent and format SQL Server stored procedures

41,212

Solution 1

Here's a couple -- no idea how well they work, unfortunately...

http://www.wangz.net/gsqlparser/sqlpp/sqlformat.htm (free)

http://www.sqlinform.com/ (free for personal use)

Solution 2

Try using ApexSQL Refactor. It integrates into SSMS and it’s a free tool. Good thing about it is that it allows to save formatting options and share them with the team so all of you use the same settings for code.

Solution 3

Try redgate SQLPrompt. It has a 14-day trial.

Solution 4

Red Gate "SQL Refactor" Very good. We bought it

Or

SSMS tools pack Free, but we don't use the layout features

Solution 5

Check out Sql assist:

It has some format feature.

http://www.roundpolygons.com/Default.aspx?PageContentID=5&tabid=92

I would suggest downloading the evaluation version to see whether it fits your need.

Share:
41,212
Malik Daud Ahmad Khokhar
Author by

Malik Daud Ahmad Khokhar

Interested in React, Node.js, Hyperledger Fabric/Composer, docker.

Updated on March 07, 2020

Comments

  • Malik Daud Ahmad Khokhar
    Malik Daud Ahmad Khokhar about 4 years

    In my current project I've been inherited with lots of long (1200+ lines) SQL Server stored procedures with some horrible indentation and formatting which makes them almost unreadable. Is there some tool that I can use to automatically format these and make them more readable? I don't want to go through it manually and indent it.

  • Tomalak
    Tomalak about 15 years
    SQLinform works very well, actually. Lots of options, you can lay out code the way you like best.
  • Admin
    Admin over 13 years
    Here is an article that introduce how to format SQL in your own program automatically : dpriver.com/blog/…
  • Binoj Antony
    Binoj Antony over 12 years
    Does not do indentation, only changes case :(
  • Guido
    Guido over 9 years
    SQLinForm now has a free desktop version for SQL statements up to 100 lines which should be fine in most cases