1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| CREATE TRIGGER [Trig_RallyTarif] ON [RALLYTARIF]
FOR INSERT
AS
declare @temp as int, @id_tarfourn as int, @id_tarref as int, @gencod as varchar(13),
@ref as varchar(15), @libelle as varchar(30), @famille as varchar(30),
@cond as varchar(30),
@pt as decimal(12,2), @Zl1 as varchar(30), @Zl2 as varchar(30), @Zl3 as varchar(30)
select @id_tarfourn = id_tarfourn, @id_tarref = id_tarref, @gencod = gencod, @ref = reference,
@libelle = libelle, @famille = famille, @cond = cond, @pt = pt, @Zl1 = zl1, @Zl2 = zl2, @Zl3 = zl3
from inserted
select @temp = R.id_tarif from rallytarif R
where R.id_tarfourn = @id_tarfourn and R.id_tarref = @id_tarref and R.reference = @ref
begin
update rallytarif
set gencod = @gencod, libelle = @libelle, famille = @famille, cond = @cond, pt = @pt, zl1 = @zl1, zl2 = @zl2, zl3 = @zl3
where id_tarif = @temp
commit tran
end |
Partager