您现在的位置: 万盛学电脑网 >> 程序编程 >> 数据库 >> mssql数据库 >> 正文

SQL2005行触发器

作者:佚名    责任编辑:admin    更新时间:2022-06-22

   SQL2005行触发器

  ALTER TRIGGER [dbo].[update_email_template]

  on [dbo].[E3_DICT_TABLE]

  after update

  as

  begin

  IF (UPDATE (value))

  declare @plid varchar(max)--临时变量,保存 更新数据的 value

  declare @oldValue varchar(max)--临时变量,保存 更新前value

  declare @newValue varchar(max)--临时变量,保存 更新后value

  select @plid = id, @oldValue = value from DELETED;

  select * from inserted;

  where id = @plid;

  -- print @plid;

  -- print @oldValue #topEmailTem #bottomEmailTem;

  -- print @newValue;

  begin

  if (@plid = '1')

  print @oldValue;

  print @newValue;

  if (@plid = '2')

  end

  end