I was wondering if there is a plugin/tool for SQL Server Management Studio that will format your SQL?
- Free Online Tools For Developers. I created this website to help developers by providing them with free online tools. These tools include several formatters, validators, code minifiers, string escapers, encoders and decoders, message digesters, web resources and more.
- The Free Online SQL Formatter formats SQL for all major DB like Oracle, DB2, SQL Server, Teradata, Netezza, MySQL, Sybase, MS Access, etc. The formatted SQL can be plain SQL or SQL embedded in Java, C#, PHP Visual basic and many more.
I'm working with some large-ish stored procs that are a mangled mess of poorly formatted SQL and it'd be nice if I could just go 'Select All -> Format SQL'
SQL Formatter. SQL Formatter is an extension for formatting of SQL files using NodeJS component. In order for the extension to work correctly, it is necessary to have NodeJS installed, since one component will be used, being sql-formatter. Performs SQL Formatter to format your code using NodeJS component. Execution Commands. It is a simple free solution for formatting/beautifying SQL statements online. I decided to make this tool as a way to combine all the functionality I wanted in a tool like this while keeping it ergonomic. You can import SQL from a file on your local machine, load from a URL online or just paste it into the editor on the left. Free Online Tools For Developers. I created this website to help developers by providing them with free online tools. These tools include several formatters, validators, code minifiers, string escapers, encoders and decoders, message digesters, web resources and more. I will add new tools on a regular basis, so be sure to add this site to your bookmarks.
lomaxxlomaxxclosed as off-topic by kleopatra, Ben, liyakat, LSerni, rcsOct 14 '13 at 7:08
This question appears to be off-topic. The users who voted to close gave this specific reason:
- 'Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.' – kleopatra, Ben, liyakat, LSerni, rcs
11 Answers
Today I discovered Apex SQL Refactor. It is a free plugin. Integrates with SSMS. Downside is that it is an all or nothing process. It does not refactor as you type.
MauMenSql Formatter Free Online Software
MauMenLate answer, but hopefully worthwhile: The Poor Man's T-SQL Formatter is an open-source (free) T-SQL formatter with complete T-SQL batch/script support (any DDL, any DML), SSMS Plugin, command-line bulk formatter, and other options.
It's available for immediate/online use at http://poorsql.com, and just today graduated to 'version 1.0' (it was in beta version for a few months), having just acquired support for MERGE
statements, OUTPUT
clauses, and other finicky stuff.
The SSMS Add-in allows you to set your own hotkey (default is Ctrl-K, Ctrl-F, to match Visual Studio), and formats the entire script or just the code you have selected/highlighted, if any. Output formatting is customizable.
In SSMS 2008 it combines nicely with the built-in intelli-sense, effectively providing more-or-less the same base functionality as Red Gate's SQL Prompt (SQL Prompt does, of course, have extra stuff, like snippets, quick object scripting, etc).
Feedback/feature requests are more than welcome, please give it a whirl if you get the chance!
Disclosure: This is probably obvious already but I wrote this library/tool/site, so this answer is also shameless self-promotion :)
TaoTaoThere is a special trick I discovered by accident.
- Select the query you wish to format.
- Ctrl+Shift+Q (This will open your query in the query designer)
- Then just go OKVoila! Query designer will format your query for you.Caveat is that you can only do this for statements and not procedural code, but its better than nothing.
Free Online Solitaire
JustinRed-Gate makes a couple, either Sql Prompt Pro or Sql Refactor. There are a million others out there that do not plug into management studio, but Red-Gate makes the only plugin I know of and it works very well. They also provide intelli-sense and a few other useful features.
Shane DelmoreShane DelmoreThis is a free, online one: http://www.sqlinform.com/ (requires Java Runtime Environment)
Mitch WheatMitch WheatIt is not built in, but it's fast to use it. :)http://www.dpriver.com/pp/sqlformat.htm
Not a plugin for SSMS, but I find this handy to keep as a bookmark in my browser:http://www.dpriver.com/pp/sqlformat.htm
Edit: Oops - I just noticed they have versions for SSMS, Visual Studio, and a desktop version etc. Haven't tried them personally yet.
Phil HaseldenPhil HaseldenThis one (Gudu Software) is pretty good, works in Management Studio and is pretty cheap. It needs more options in my opinion but haven't used it for a few months, maybe they've added some new features. I was happy with it when I used it. Also has a free online version.
edosoftSSMS Tools Pack does a good job of formatting and the other tools in the pack come in quite handy
z-bossThis web site here does basic SQL keyword capitalisation:
gb2dgb2dOr you could try my formatter.It is not free. it is a command line tool and it can integrated with SSMS as an external tool....Tidycode T-Sql Formatter
AftershockAftershock