question on SQL trigger - TechRepublic
General discussion
July 29, 2004 at 10:47 PM
hunterzh

question on SQL trigger

by hunterzh . Updated 21 years, 9 months ago

I??m programming with T-SQL, to create a trigger as the following:
create trigger orderinsert_price
on seorderentry
for insert,update
as
declare @band varchar(20)
select @band=t1.f_103
from inserted s1,seorder s2,t_item3012 t1
where s1.finterid=s2.finterid
and s2.fcustid=t1.f_101
and s1.fitemid=t1.f_102

update seorderentry
set fprice=
(case @band
when ‘A’ then t2.f_103
when ‘B’ then t2.f_104
else 0
end)
from inserted s1, t_icitem t2
where s1.fitemid=t2.fitemid
but it always prompts me that f_103 and f_104 are invalid column names.
Does it have any logical problem for the above? You needn’t pay attention to details, just the main structure.

This discussion is locked

All Comments