declare @resultCount numeric(10);
select @resultCount=count(0) from sysobjects so join syscolumns sc on so.id=sc.id
where so.xtype='u' and so.name='Sterilizer' and sc.name='needNoticeSterilisation';
if @resultCount >= 1 begin
	execute sp_executesql 'insert into SterilizationFrequecyRemind (frequency, remindMode, sterilisation_id, sterilizer_id) select 1, ''非强制提醒'', ss.id, s.id from sterilizer s join sterilisation ss on s.needNoticeSterilisation = ss.sterilisation where s.needNoticeSterilisation is not null and s.needNoticeSterilisation <> ''''';
	execute sp_executesql 'update Sterilizer set needNoticeSterilisation = null where needNoticeSterilisation is not null';
end;