Published 29 October 2019
SQL Prompt keeps a history of query tabs you open in Management Studio. SQL Prompt saves the contents of these tabs whenever:
- a query is executed
- a query window (tab) is saved
- a query window (tab) is closed
- a query window (tab) loses focus
- the tab history window is opened
If you close a tab without saving the code, you can reopen it from the Tab History list, and the code will be as it was before you closed it. If you close down SSMS without saving tabs, or SSMS crashes, SQL Prompt will automatically restore all tabs that were open prior to the shutdown/crash, with their contents in the state when the last of the above actions occurred.
You can use Tab history in Management Studio 2012 or later. Visual Studio is not supported.
Browsing tab history
To browse your tab history, on the Management Studio toolbar, click Tab History:
The tab history window is displayed:
The tab history window shows the following information about each tab:
the file name
- the SQL Server and database the tab was connected to
- the time the tab was closed
the contents of the tab (SQL code)
All text in a tab (which may include sensitive information) is saved to the history. Find out how to remove tabs from the history.
To view a list of tabs that are currently open, click Open tabs:
Using the keyboard
To browse open tabs, press Ctrl + Shift + X.
You can also navigate the tab history window using the keyboard:
- To move through the tab list, press the Up or Down arrows.
- To open the selected tab, press Enter.
- To switch between the All tabs and Open tabs lists, press Ctrl + Left arrow or Ctrl + Right arrow.
Renaming a closed tab
- In the tab list, right-click the tab you want to rename, and click Rename:
- Type a new name for the tab, and press Enter.
You can't rename open tabs.
Closing an open tab
In the tab list, right-click the tab you want to close, and click Close:
Removing tabs from the history
When you remove a tab from the history it is permanently deleted; you can't restore it.
You can remove a single closed tab, or a set of old closed tabs from the history.
To remove a single tab, in the tab list, right-click the tab you want to remove and click Remove:
To remove old tabs, in the tab list, right-click the oldest tab you want to keep and click Remove tabs older than this:
As of SQL Prompt 10, you can star your favourite or most commonly used tabs, so you can navigate to them easier. These starred tabs are marked with a yellow star in the tab list.
To star/unstar a tab, simply click the star icon. If you wish to see only starred tabs, you can click Starred to filter out all unstarred ones.
Restoring open tabs
When you start Management Studio, SQL Prompt automatically restores open tabs from your previous session.
If you don't want SQL Prompt to restore tabs:
- On the SQL Prompt menu, click Options.
- Under Tabs, click Tab history:
- Under Open tabs, clear the Restore open tabs when SQL Server Management Studio starts check box.