27

I mean, something equivalent to Ctrl + K + D from Visual Studio that automatically indents code. Is there something in this sense?

Andre Pena
  • 56,650
  • 48
  • 196
  • 243
  • 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 Answers5

21

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 :)

Community
  • 1
  • 1
Tao
  • 13,457
  • 7
  • 65
  • 76
16

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.

Orland Mendes
  • 516
  • 4
  • 5
10

SQL Prompt from Red Gate can do this.

If you just want simple formatting online then the same technology powers FormatSQL.com

Mitch Wheat
  • 295,962
  • 43
  • 465
  • 541
3

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

ChrisWerry
  • 135
  • 3
1

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

Guido
  • 926
  • 2
  • 10
  • 19