It’s sometimes too easy to close SQL Server Management Studio (SSMS) without saving your work. It’s also easy to get rid of tabs and scripts that you later wish you had back. SQL Prompt can help with both these problems.
Take a look at the Options for SQL Prompt and you’ll find a set of options under Tabs > History:
You can enable or disable tab history according to your own preferences. Once it’s enabled, you get a number of behaviors that can prove extremely helpful.
First up, you can restore on launch all the tabs you had open when you last closed SSMS. Reopening your tabs helps ensure that you see the same work as you did when you closed it. Further, if you didn’t save that tab, no worries because tab history has all the T-SQL code, just as it was before you closed it, covering for you in the event of a problem. Tab history can also reconnect the tabs to the databases they were connected to prior to closing them.
There is also a literal history of the tabs on your system. You can use the keyboard shortcut designated above, Ctrl+Q, or you can use a button installed on the button bar to get a history of the tabs you had open in your SSMS environment:
This shows the tabs currently open, but you can see that there is a listing under All tabs for closed tabs. By clicking on Closed, I get a list of all the tabs going back in time that I’ve had open on this SSMS instance:
This allows me to track down previously opened tabs, even if I didn’t save them. I also get the ability to search across these tabs. For example, if I know that one of my previously opened tabs contained scripts for setting up Extended Event sessions within Azure SQL Database, I can simply type
session in the search window:
I get the tab, the scripts, its location on the disk and the last time I closed it. I can then browse through the script by scrolling on the right or browse the scripts by scrolling through them on the left.
Never again should you worry about forgetting to save a script or losing track of where it was on your disk. With SQL Prompt tab history, you’ll be protected and assisted when managing your tabs.
If you’re not a SQL Prompt user, download a free trial and see how much more productive you can be writing code every day.
Like this? Share it with other SQL professionals using the social sharing buttons below. Simply tweet: I’ve just read @ GFritchey’s blog on restoring tabs with #SQLPrompt – see the #SuperSQLTip at http://rd.gt/2khoRyZ.