I mean, something equivalent to Ctrl + K + D from Visual Studio that automatically indents code. Is there something in this sense?
-
Thes SQL Formatter at www.sqlinform.com has a window hotkey function which could do the same – Guido Aug 24 '14 at 18:20
5 Answers
Just discovered this - yet another variation on this older question which has much more activity: SQL Formatter for SQL Management Studio
I personally am a big fan of the Poor Man's T-SQL Formatter / http://poorsql.com - but then I wrote it :)
-
1
-
1Thank you for making the poor man's tsql formatter. You've saved a lot of hours here. – Lorraine May 21 '19 at 14:36
By default no but you can always try a third party tools like SQL Prompt mentioned above or ApexSQL Refactor (slightly less options compared to SQL Prompt but it’s a free product) or just use online formatter.

- 516
- 4
- 5
SQL Prompt from Red Gate can do this.
If you just want simple formatting online then the same technology powers FormatSQL.com

- 295,962
- 43
- 465
- 541
-
Looks like a great product! It's just too bad it's so pricey! (Around $300 at the time of this post) – Dubs Feb 02 '10 at 14:36
-
Format SQL is great! Thanks! I wonder why there is no inbuilt function for thid. – TheGateKeeper Apr 26 '12 at 10:09
SQL Pretty Printer can also reformat SQL. Available as a stand alone app or a SSMS plugin. Free to download (with a nag screen but no other apparent limitations) from http://www.dpriver.com
There is an online version at http://www.dpriver.com/pp/sqlformat.htm?ref=g_wangz

- 135
- 3
There is also the SQLinForm formatter. It is an automatic SQL code formatter for all major databases including ORACLE, SQL Server, DB2, UDB, Sybase, Informix, PostgreSQL, Teradata, MySQL, MS Access etc. with over 100 formatting options.It has a windows hotkey add-on, so you can use it in SSMS. Link: www.sqlinform.com

- 926
- 2
- 10
- 19