SQL: Useful shortcuts

I was searching the internet for useful shortcuts for SQL Server, and came across this Stack Overflow post – http://stackoverflow.com/questions/101079/sql-server-management-studio-tips-for-improving-the-tsql-coding-process

Below are some useful highlights that I will be using:

  • Rectangular Selection – To create a rectangular selection for copying or deleting, press ALT and then drag from corner to corner.
  • Comment Selection – To comment out a selection of lines, press CTRL + K and CTRL + C
  • Uncomment Selection – To remove comments from a selection of lines, press CTRL + K then CTRL + U
  • Query Designer – To display the Query Designer press CTRL + SHIFT + Q
  • List of columns in Query Window – From Object Explorer, expand a table, and drag the “Columns” node Object Explorer into a query windows.  It will create a CSV list of columns.
  • Display Estimated Execution Plan – Ctrl+L
  • Show/Hide Results Pane – Ctrl+R
  • Query Shortcuts
    • Alt+F1 – executes sp_help.  Simple highlight a table or another object in the Query Window, and press Alt+F1 to show the sp_help information
    • Ctrl+1 – executes sp_who
    • Ctrl+2 – executes sp_lock
    • To change these shortcuts, or other Ctrl+number keys, go to Tools, Options, Environment, Keyboard, and Query Shortcuts

Enjoy! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.