How to stop my query editor from closing on its own

Tameka 0 Reputation points
2026-08-06T17:19:36.4333333+00:00

I'm constantly getting a pop up asking me to save queries I am still working on. Sometimes I open an instance that has been idle just to realize the query I had open has been closed or disappeared. Plus I have checked the copy with header option in the Tool settings multiple times and it still won't copy the header.

SQL Server Reporting Services
SQL Server Reporting Services

A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.


2 answers

Sort by: Most helpful
  1. Deepesh Dhake 835 Reputation points
    2026-08-07T15:09:38.1766667+00:00

    Save pop-ups: Tools then Options then Query Execution then SQL Server then General then uncheck "Prompt to save unsaved T-SQL query windows on close."

    Losing open queries: Turn on AutoRecover under Tools then Options then Environment then AutoRecover. To recover lost text from the plan cache (needs VIEW SERVER STATE):

    SELECT t.text, s.last_execution_time
    FROM sys.dm_exec_query_stats s
    CROSS APPLY sys.dm_exec_sql_text(s.sql_handle) t
    ORDER BY s.last_execution_time DESC;
    

    Copy with headers: Tools then Options then Query Results then SQL Server then Results to Grid then check "Include column headers when copying or saving the results," then open a new query window.

    Was this answer helpful?

    0 comments No comments

  2. Tameka 0 Reputation points
    2026-08-07T12:04:44.9233333+00:00

    I am using Sql Server Mgmt Studio 22.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.