SQL2005行觸發(fā)器

字號(hào):


    SQL2005行觸發(fā)器
    ALTER TRIGGER [dbo].[update_email_template]
    on [dbo].[E3_DICT_TABLE]
    after update
    as
    begin
    IF (UPDATE (value))
    declare @plid varchar(max)--臨時(shí)變量,保存 更新數(shù)據(jù)的 value
    declare @oldValue varchar(max)--臨時(shí)變量,保存 更新前value
    declare @newValue varchar(max)--臨時(shí)變量,保存 更新后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