I mean, something equivalent to Ctrl + K + D from Visual Studio that automatically indents code. Is there something in this sense?
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 :)
2 Comments
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.
Comments
SQL Prompt from Red Gate can do this.
If you just want simple formatting online then the same technology powers FormatSQL.com
2 Comments
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
1 Comment
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