--增加分类 GO IF EXISTS(SELECT * FROM SYS_ScriptCategories WHERE id=193) Delete from SYS_ScriptCategories WHERE id=193 insert into SYS_ScriptCategories(ID,Code,Name,ComponentID,xRowNum,ParentID,xLevel,Description) Values(193, 'YZSPGL001', '医嘱审批管理', 130, 0, 0, 0, '医嘱审批管理') GO --删除旧记录 delete from SYS_Scripts where id=20324 --删除脚本内容 GO GO IF EXISTS(SELECT * FROM SYS_Scripts WHERE id=20324) Delete from SYS_Scripts WHERE id=20324 insert into SYS_Scripts(ID,CategoryID,Code,Name,Description,xType,DatasourceID,DisplayNames,xRowNum,xText,UpdateDate,UpdateUser,UpdateMode,Custom) Values(20324, 193, 'Sql_选择医技科室', 'Sql_选择医技科室', '选择医技科室', 1, 0, ' select BCK01, BCK02, BCK03, BCK04, ABBRP, ABBRW, BCK01A, BCK09, ACA01, BCK13, BCK15, BCK16 from BCK1select BCK01, BCK02, BCK03, BCK04, ABBRP, ABBRW, BCK01A, BCK09, ACA01, BCK13, BCK15, BCK16 from BCK1 ', 1, 'select top 0 BCK01, BCK02, BCK03, BCK04, ABBRP, ABBRW, BCK01A, BCK09, ACA01, BCK13, BCK15, BCK16 from BCK1', '2020-07-14 11:31:00', '(8088)王海涛', 0, 0) GO If EXISTS(SELECT * from Sys_CustomScripts WHERE ID = 20324) Update a SET a.Custom = b.Custom from SYS_Scripts a join Sys_CustomScripts b on b.ID = a.ID where a.ID=20324 GO