首页 > 代码库 > 创建触发器

创建触发器

if (object_id(tr_wuliu_rk_mx, tr) is not null)    drop trigger tr_wuliu_rk_mxgo CREATE TRIGGER tr_wuliu_rk_mx  ON [dbo].[wuliu_rk_mx] FOR INSERT, UPDATE, DELETE asdeclare @tzdbh varchar(100) declare @yeartype  varchar(100)declare @seasontype  varchar(100) --更新时if update(seasontype)beginselect @tzdbh =tzdbh ,@yeartype =yeartype,@seasontype =seasontype from inserted update wuliu_rk_mx set seasontype=春季 where tzdbh=@tzdbh and ltrim(rtrim(yeartype))=2015 and ltrim(rtrim(seasontype))=秋季end

 

创建触发器