SSMS shortcut to navigate between open query windows

24,011

Solution 1

SSMS 2008

Ctrl+F6 will switch between two most recent tabs. And honestly, Ctrl+Tab / Ctrl+Shift+Tab work like next/previous except you have to hit Tab twice (you can ignore knowing what the name of the tab in the list is).

That said, have you considered upgrading to SQL Server 2012 Management Studio? A lot of its features are much more refined than the 2008 version (and you will still be able to manage your 2008 servers). A challenge you'll find here is what does "next" really mean? Since you can tear off tabs, split the UI, even move tabs onto different monitors, I think "next" and "previous" lose a little meaning unless you know what order they were opened in...

SSMS 2012

  • Ctrl+F6 will cycle through open tabs in the order they are displayed, and Ctrl+Shift+F6 will cycle in the reverse direction.
  • Ctrl+Tab / Ctrl+Shift+Tab will open a temporary window and allow you to cycle through open queries in the order they were last opened.

Solution 2

the equivalent of Ctrl+Tab in browsers for SSMS would be Ctrl+Alt+PageDown for next tab and Ctrl+Alt+PageUp for previous tab.

Solution 3

Here's my approach that get's me closer to coding utopia. Make sure you keep your SSMS query windows sorted by name from left to right. SQLQuery1.sql, SQLQuery2.sql, etc. These are the default names SSMS gives these tabs when you create them (by clicking New Query).

To change the current query window tab, press "alt" then "w" then "w". A window is shown listing all of your open query windows sorted by their names (which should be the same order in which you have them laid-out from left to right). Use the up and down arrow keys to highlight the tab you want to activate and press enter. Your desired tab should be open now.

This allows me to quickly change query windows while keeping my fingers on the keyboard (less mouse usage).

Solution 4

I know this is a very old thread, but I thought I would add one more suggestion in case someone else comes across this: Redgate's SQL Prompt comes with a nifty "Tab History" applet that gets added as a button to a toolbar. I know that that means you would have to leave the keyboard and reach for the mouse to access it, but the interface and its functionalities are worth it! Not only do you have access to the currently opened tabs (with visual mini previews of the code in each tab) but also you have access to recently closed tabs (Yes, it may save you in case you accidentally close a tab without saving your work...)

Just my two cents. Best, Raphael

Share:
24,011

Related videos on Youtube

Ewald Stieger
Author by

Ewald Stieger

Updated on July 16, 2021

Comments

  • Ewald Stieger
    Ewald Stieger almost 3 years

    I sometimes have a large amount of query windows open in SSMS 2008.

    Is there a keyboard shortcut to navigate between open query windows? Go to previous/next open query window?

    I know there is Ctrl+Tab that allows you to select a query window, but it's only helpful if you have named windows.

  • Ewald Stieger
    Ewald Stieger over 11 years
    Thanks! Guess it is the Ctrl+F6 I was looking for as I just want to quickly cycle through the open windows. Ctrl+Tab opens that intermediate window which makes it slow... Will see if I can upgrade to 2012.
  • chris
    chris over 9 years
    just to be clear - Ctrl + F6 iterates circularly through the open tabs
  • Gustavo Pinsard
    Gustavo Pinsard about 4 years
    This should be the accepted answer. Ctrl+Alt+PageDown / Up are, actually, faster to reach and much more mnemonic than the other methods suggested, which require multiple steps and prior visual evaluation.
  • Mauro
    Mauro almost 4 years
    Note, Ctrl + Alt + PageDown / Up just go through the visible tabs and, oddly enough, this shortcut is not listed in the official documentation
  • Dick Kusleika
    Dick Kusleika over 2 years
    Ctrl+Shift+X will open SQL Prompt's tab history and Ctrl+Arrow will move between All, Open, Close, and Starred.
  • Andy Robertson
    Andy Robertson about 2 years
    Don't hit CTRL+F5 by mistake though as this will execute your script. I don't like this as a shortcut to cycle through tabs/windows.