Hello Yochanan_Rachamim
Am testing your script.
I have a question regarding the lines below:
<<--------------------------------
if @debug!='none'
begin
drop table if exists idxBefore
drop table if exists statsBefore
drop table if exists cmdQueue
if object_id('tempdb..#idxBefore') is not null select * into idxBefore from #idxBefore
if object_id('tempdb..#statsBefore') is not null select * into statsBefore from #statsBefore
if object_id('tempdb..dbo.AzureSQLMaintenanceCMDQueue') is not null select * into cmdQueue from dbo.AzureSQLMaintenanceCMDQueue
end
-------------------------------->>
I see your script create 3 new tables (idxBefore ,statsBefore & cmdQueue ).
do they phisically remain even after the execution of the SP: [dbo].[AzureSQLMaintenance] ?
btw: for table creation of AzureSQLMaintenanceCMDQueue, I noticed that schema has to be taken into consideration
dbo.AzureSQLMaintenanceCMDQueue.
Is it required to create these 3 tables ? if so, i will need to ad dbo schema to each one.
Thanks for your feedback.