What is the equivalent of Ctrl + K + D (Visual Studio) in Sql Server Management Studio which is use to format the code ?
Asked
Active
Viewed 1.8k times
7
-
1possible duplicate of [SQL Formatting Tool](http://stackoverflow.com/questions/627643/sql-formatting-tool) – Curtis Sep 12 '11 at 08:58
-
1Possible duplicate of [SQL Formatter for SQL Management Studio](https://stackoverflow.com/questions/401928/sql-formatter-for-sql-management-studio) – icc97 Mar 19 '18 at 11:20
-
@Curt that question is now closed as a duplicate of [SQL Formatter for SQL Management Studio](https://stackoverflow.com/questions/401928/sql-formatter-for-sql-management-studio). Plus this one at the bottom of the rabbit hole is closed too. – icc97 Mar 19 '18 at 11:21
1 Answers
3
Upcoming SQL Server 2011 seems to have a similar feature, but previous versions doesn't have it. Click on the referenced link and you will see that;
- Applies the indenting and space formatting for the language specified on the Formatting pane of the language in the Text Editor section of the Options dialog. Available only in the text editor. ( CTRL-K, CTRL-D )
- Correctly indents the selected lines of code based on the surrounding lines of code ( CTRL-K, CTRL-F )

a.b
- 9,414
- 5
- 26
- 22
-
1As far as I can tell, this is only for formatting XML, at least in Management Studio 17. There is no 'Formatting' pane for Transact-SQL in the options dialog, only for XML – icc97 Mar 19 '18 at 11:19