Scripting Delete action to new query window is deleting the maintenance plans without even executing the script
SQL Server version: Microsoft SQL Server 2014 (SP2) (KB3171021) - 12.0.5000.0
Tested using SSMS 17 and SSMS 12
Scripting Delete action to new query window for Maintenance plans is deleting the maintenance plans without actually executing the script:
1)Create a maintenance plan using maintenance plan wizard
2)This creates maintenance plan under path : Server or Instance Name>Management>Maintenance Plans along with a corresponding job under Sql server agent when viewed from SSMS
3)Now right click on the Maintenance plan that gets created from step 1 in location specified in step 2 above and click delete
4)But instead of clicking OK use the script button on top of window and select "script action to new query window" and then click CANCEL in the same window from where we just selected script action.
5)So we just scripted the action and haven't actually deleted the plan nor by clicking OK nor by executing the script that gets created in new window.
6)But now if you right click and refresh the maintenance plans folder in ssms you will notice that the maintenance plan has already got deleted.
7)The other thing to note is that the corresponding job under sql agent is not deleted when this happens so go ahead and refresh jobs folder under sqlagent in ssms and you will see the jobs still hanging around there and when you try to delete them manually you get the error
--More Details : http://www.tcbin.com/2018/02/sql-server-ssms-bug-scripting-delete-mantenance-plans-fix.html
thanx, we’ll look into a fix for a future release to help avoid data loss.