

--把合理用药19877脚本放到自定义脚本
 if EXISTS(SELECT * from Sys_CustomScripts WHERE ID = 19877  and Custom=0 )
delete from Sys_CustomScripts  where id=19877 --删除未启用的自定义脚本内容
go 

If  NOT EXISTS(SELECT * from Sys_CustomScripts WHERE ID = 19877 )
begin
Update a SET a.Custom = 1 from SYS_Scripts a where a.ID=19877

insert into Sys_CustomScripts 
 SELECT * FROM SYS_Scripts WHERE id=19877
 end 

GO


