I am trying to use Ctrl K + Ctrl D (format document) in SQL Server Management Studio. It gives the message
The key combination (key, key) is bound to command(command) which is not currently available.
I also tried Ctrl A + Ctrl K + Ctrl F, and that didn't work either.
Is there any update or fix that I need to install for that?
Format SQL Code in SSMS Query Window To use the SSMS add-in component we will have to close and then open SSMS after the install of the add-in. Then open a SSMS query window, highlight the code that needs to be formatted. Then select Format T-SQL Code from the SSMS Tools menu. Here is the code after the formatting.
Format SQL code using SSMS optionsSSMS provides a couple of options to format SQL code. Those options are indenting, tab sizing, make all code in upper or lower case, comment/uncomment selected code, etc.
Select Edit -> SQL Formatter -> Format Selected Query (or press Ctrl+F12). -- Format All Queries: To format the whole batch of queries entered in the SQL window. Select Format -> SQL Formatter -> Format All Queries (or press Shift+F12).
There is nothing to fix - SQL Server Management Studio is not Visual Studio and does not contain a SQL pretty printer.
In other words, SSMS does not have a document formatting option out of the box.
See the answers to SQL Formatter for SQL Management Studio for options.
I was struggling with this, Finally found this Ctrl +K, Ctrl+Y and it worked for me. But you need to have SQL Prompt.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With