--增加分类 GO IF not EXISTS(SELECT * FROM SYS_ScriptCategories WHERE id=1) insert into SYS_ScriptCategories(ID,Code,Name,ComponentID,xRowNum,ParentID,xLevel,Description) Values(1, 'SC1', 'HOMaster 基础管理', 1, 0, 0, 0, Null) else print 'SYS_ScriptCategories.id=1 已经存在.' GO --删除旧记录 delete from SYS_Scripts where id=7361 --删除脚本内容 GO GO IF not EXISTS(SELECT * FROM SYS_Scripts WHERE id=7361) insert into SYS_Scripts(ID,CategoryID,Code,Name,Description,xType,DatasourceID,DisplayNames,xRowNum,xText,UpdateDate,UpdateUser,UpdateMode) Values(7361, 31, 'Sql_获取材料发药明细', '', '获取材料自动冲减库存发药明细', 1, 1, Null, 1, 'select a.VAJ01,a.VAI01,a.VAJ09,a.VAA01,a.BBY01,a.VAJ25,a.VAJ32,a.VAJ33,a.VAJ36,a.VAJ38,a.VAJ54 from VAJ2 a where a.VAJ48 = 0 and a.BDN01 in (''4'',''M'') and a.VAI01 in (%s) and a.BCK01D = %d ', '2014-07-01 17:55:59', '(8088)王海涛', 0) else print 'SYS_Scripts.id=7361 已经存在.' GO