drop trigger upsaledate
go
create trigger upsaledate
on saledate
after update
as
if(update() & 14) /*这地方有错,我想修改saledate的第2,3,4列时,向audisaledate表中添加一条跟踪记录
begin
insert into audisaledate
(audi_log_type,
audi_customerbankaccount,
audi_customeraddress,
audi_customername,
audi_sale_id,
audi_sale_name,
audi_sale_qua,
audi_sale_date)
select
'old',
d.audi_customerbankaccount,
d.audi_customeraddress,
d.audi_customername,
d.audi_sale_id,
d.audi_sale_name,
d.audi_sale_qua,
d.audi_sale_date from deleted d
insert into audisaledate
(audi_log_type,
audi_customerbankaccount,
audi_customeraddress,
audi_customername,
audi_sale_id,
audi_sale_name,
audi_sale_qua,
audi_sale_date)
select
'new',
i.audi_customerbankaccount,
i.audi_customeraddress,
i.audi_customername,
i.audi_sale_id,
i.audi_sale_name,
i.audi_sale_qua,
i.audi_sale_date from inserted i
end