Problem
Sometime we may write a SQL script to verify the data or monitor any activities or adhoc tasks in database. In that case, We opens "N" number of Query windows and continue our activities in SSMS. We may not required to keep/save the scripts, but when we close the windows we will get as many number of prompts for save/cancel the changes. also you will be forced to click each and every annoying save prompts.
Solution:
This Problem is resolved in SSMS 2016 release.
Microsoft has provided a new option to avoid prompting for saving unsaved files.
To use this feature, Go to "Tools" Menu > Options > Query Execution > SQL Server > General > Un-check "Prompt to save unsaved T-SQL query windows on close"
Note:
You have to disable this option before open any query window, otherwise SSMS will prompt the save changes window at the time of closing
Do not disable this option, if you do, you may lose valid scripts one day if you forget to save the changes when you close any script accidentally. so don't forget to enable this option after use.
Requested By:
A connect item was raised to add this feature by Erland Sommarskog, Refer
Connect #308372, which replaced Connect #124686. It was denied by Microsoft earlier and closed the ticket stating as "Won't Fix", But due to Many People requests, Now Microsoft has introduced this feature in SQL 2016