CREATE EVENT "MD_HEADER_sni_sno_reindex" ENABLE AT ALL 
HANDLER
begin
  call xp_write_file('c:\\alpha\\aa_log_start.txt',string(getdate(*)));
  drop index i_md_sni;
  create unique index i_md_sni on md_header(md_sni_sid asc);
  drop index i_md_sno;
  create unique index i_md_sno on md_header(md_sno_sid asc);
  call xp_write_file('c:\\alpha\\aa_log_end.txt',string(getdate(*)))
end;

ALTER EVENT "MD_HEADER_sni_sno_reindex" 
    ADD SCHEDULE "MD_HEADER_sni_sno_reindex_1" 
        BETWEEN '01:00:00' AND '02:00:00' EVERY 24 HOURS START DATE '2022/12/05'  

