SQL Server Management Studio Query Designer Shortcuts
While writing and editing scripts, we often try to use the keyboard as much as possible. This should be the same for SQL Server scripts as well. When using the Query Designer in SSMS there are some shortcuts that will help you be more efficient and in this tip we will take a look at a few of these shortcuts.
As you know, shortcut keys play a vital role. A shortcut is a key or combination of keys assigned to perform an operation.
The best and familiar shortcut keys are:
- Save (CTRL + S) or (ALT + F + S)
- Copy (CTRL + C)
- Paste (CTRL + V)
- Cut (CTRL + X)
- Undo (CTRL + Z)
- Redo (CTRL + Y)
These are all familiar shortcuts keys which are common and standard across most of the modern operating systems and associated applications to perform the same activities.
In this tip, we will look at a couple of shortcut keys to work with the "Query Designer" editor in SSMS.
Launch Query Designer in SSMS
The Query Designer is an interface in SSMS and it will help us design a query in visual mode. Creating a query through the "Query Designer" is sometimes easier and faster than writing scripts. To learn more about "Query Designer" please refer to this article SQL Server Management Studio Query Designer.
The designer can be launched in two ways. One is via the Menu and other is through shortcut keys.
Launch "Query Designer" via SSMS Menu
From the top menus in SSMS, click on "Query" then select "Design Query in Editor" to launch the designer as shown below.
Note: the Query menu is only visible when the mouse is in a Query Window
Launch "Query Designer" via Shortcut Keys (CTRL + SHIFT + Q)
Press CTRL + SHIFT + Q to launch the "Query Designer".
Please note that the "Query Designer" will display a list of tables from the database in context, so before launching the "Query Designer" set the database by using the "USE" command as shown below or select the database from the database selector in SSMS.
USE AdventureWorks2014 GO
Or press CTRL + U key inside a query window to change the database the query will execute against.
The Query Designer interface consists of 4 sections:
- Diagram - graphical view of the query
- Criteria - listing of tables, columns for the query
- SQL - SQL code
- Results - the results when query is executed
If you right click inside the Query Designer, the following menu will open. As you can see not all features are enabled when you use the Query Designer this way.
Here are the different sections.
Each section can be toggled via shortcut keys as we will show below.
Show/hide the Diagram pane (CTRL+1)
Show/hide the Criteria pane (CTRL+2)
Show/hide the SQL pane (CTRL+3)
Execute the Query
When you are done making the changes click OK and the query will be placed in the query window so you can execute the query just like any other query.
Edit the Query Using SSMS Query Designer
If you want to make changes to a query using the Query Designer highlight the entire query in the query window and press CTRL + SHIFT + Q and the Query Designer will open with the query. Note: sometimes complex queries are not displayed correctly in the Query Designer.
Alternate Way of Using Query Designer
Another option to use the Query Designer is to right click on a table in SSMS and select "Edit Top xxx Rows". This will open the table so you can edit the table. Once the screen opens you can then use Ctrl + 1, Ctrl + 2, Ctrl + 3 as mentioned above. You can also use Ctrl + 4 which will hide and show the Results pane. Be aware that the Results pane allows you to edit the data and make changes.
- Refer to the below articles to know more about "Query Designer" and
keys in SSMS
- From technet.microsoft.com: How to Use Query Designer to Create or Modify Report Queries
- Check out the article on MSSQLTips.com which are relevant to this tip:
About the author
This author pledges the content of this article is based on professional experience and not AI generated.
View all my tips