SQL Server Management Studio Query Designer Shortcuts

By:   |   Comments (6)   |   Related: > SQL Server Management Studio Shortcuts


Problem

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.

Solution

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 Editor via Menu

Launch "Query Designer" via Shortcut Keys (CTRL + SHIFT + Q)

Press CTRL + SHIFT + Q to launch the "Query Designer".

Launch Query Editor via Shortcut Keys

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.

Query Designer - Pane

Here are the different sections.

Show/hide the SQL pane

Each section can be toggled via shortcut keys as we will show below.

Show/hide the Diagram pane (CTRL+1)

Show/Hide the Diagram Pane

Show/hide the Criteria pane (CTRL+2)

Show/hide the criteria pane

Show/hide the SQL pane (CTRL+3)

Show/hide the SQL pane

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.

Next Steps


sql server categories

sql server webinars

subscribe to mssqltips

sql server tutorials

sql server white papers

next tip



About the author
MSSQLTips author Babu Akkandi Babu Akkandi is a BI Professional and has 11+ years of experience in the IT industry and has been working with SQL Server since version 7.0.

This author pledges the content of this article is based on professional experience and not AI generated.

View all my tips



Comments For This Article




Thursday, June 25, 2015 - 6:11:32 AM - Babu Akkandi Back To Top (38033)

Hi,


@ Sankar, Gerald Britton, Scott and Jay : Thanks for your comments

Also, I'd like to thank Jeremy Kadlec for supporting me all the time till release this tip

And, I'd like to Thank the person who reviewed and edited this tip nicely

And, I'd like to Thank Dattatrey Sindol who introduced me to this site.

Best Regards,

Babu Akkandi

 


Wednesday, June 24, 2015 - 4:11:43 PM - jay Back To Top (38028)

Babu, great and good article... keep up going, write alll...


Wednesday, June 24, 2015 - 11:32:51 AM - Jeremy Kadlec Back To Top (38016)

Babu,

Congrats on your first tip and welcome to the team.

I love the animated gifs in your tip as well.  They bring in a whole new way to demonstrate how to complete a tip.

Thank you,
Jeremy Kadlec
Community Co-Leader


Wednesday, June 24, 2015 - 11:25:00 AM - Scott Back To Top (38015)

Query Analyzer used to have a toolbar button for Design Query in Editor, but it doesn't show up in Management Studio.  If you're feeling nostalgic, you can customize the SQL Editor toolbar and add it back.  I don't use it very often, especially with Intellisense, but sometimes it is handy for working with unfamiliar databases.

And I also dislike the way it formats queries.  Who puts INNER JOIN on the end of a line and the table on the next line?  This is a good reason to buy SQL Prompt or some other formatting tool.


Wednesday, June 24, 2015 - 9:18:12 AM - Gerald Britton Back To Top (38011)

Interesting, though I never use the query designer.  I find the code that it generates, though functional, impenetrable.


Wednesday, June 24, 2015 - 6:43:16 AM - sankar Back To Top (38008)

Very usefull quality article. 

 Thanks Babu, and looking for such type of tips again.















get free sql tips
agree to terms