How to View OR Retrieve all the tabs in SQL.

  • SQL query windows saves all the tabs in numerical sequence after you close each window. SO for example if you are typing query in window 1 and close it and open a new query windows it labels the new windows as SQL Query2 and so on.

    Does anyone know what is the purpose of saving the SQLQuery windows like this? And how to retrieve all the windows.

  • There's likely no purpose, just a coding issue with SSMS that increments the number of the next window.

    What does "retrieve" mean? I don't know what you are trying to do.

  • Thanks for answering.

    Retrieve meaning I was trying to view all the SQL windows or any one of the windows. So for example if I want to bring back SQL Query3, how to do it? Since each time a query windows is closed it disappear isn't it?

    I have an option to save the query window each time I close it but what if I didn't?

  • If, while closing a tab, you do not save the sql code contained in the tab it is lost. There is no reopening a previous tab to retrieve what ever query (or queries) were in that tab.

  • Lynn, I'd like to disagree regarding "no reopening a previous tab".

    There are tools out there (e.g. RedGate's SQL Prompt -> advert intented 😉 ) that'll allow you to save, search, and recover tabs in SSMS[/url]. Maybe one day MS will figure out that this is a very useful Add-On and decide to include it...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • LutzM (5/3/2014)


    Lynn, I'd like to disagree regarding "no reopening a previous tab".

    There are tools out there (e.g. RedGate's SQL Prompt -> advert intented 😉 ) that'll allow you to save, search, and recover tabs in SSMS[/url]. Maybe one day MS will figure out that this is a very useful Add-On and decide to include it...

    Okay, there is no NATIVE way to recover the contents of a tab deliberately closed without saving the contents of the tab first.

    That better?? 🙂

  • Yep. 😀

    If nothing else, at least I could promote one of RG's products 😛



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • Lynn Pettis (5/3/2014)


    If, while closing a tab, you do not save the sql code contained in the tab it is lost. There is no reopening a previous tab to retrieve what ever query (or queries) were in that tab.

    http://www.ssmsboost.com/ is another and free.

    I have no commercial interests in this product

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • In addition to Red Gate's tool, and if you get that, really, what else do you need, Mladen Prajdic's SSMS Toolpack [/url]also has the ability to recover tabs. Plus, it has versions of queries stored so you can see changes you've made over time to a particular query window.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • As mentioned, there's no native way to do this. There are a number of products, including those from my employer, Red Gate, that can help.

    These tabs are like files in notepad or Word. If you don't save them, they're gone. I typically save them quickly when I think I might use the code. I also sometimes drop a bunch of code in one large query1.sql file, commenting bits out, but keeping a scratchpad.

  • Oh, and one other idea, you might be able to retrieve a query you were working on from cache. I did this once and blogged about it here[/url]. There were also some suggestions in the comments.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Hi, I am SSMSBoost add-in developer, the add-in was already mentioned here, I just explain what it does:

    -saves every query you execute to execution history

    -saves contents history of all editor windows and allows to recover any point of your development process

    -saves information about open tabs AND their connections upon quit and allows to restore full environment after ssms restart. It even restores Query[1..].sql files if you did not save them

    -It eliminates, to some extend, the amount of QueryX.sql tabs, as far as when you "go to definition" of some object the newly created tab gets meaningful name, containing object name and schema (F2 is the hotkey to script focused object directly from editor). This naming is customizeable.

    Hope this helps

  • This was removed by the editor as SPAM

Viewing 13 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic. Login to reply