create trigger TRG_CAFE_EDIT on cafe
instead of update
as
begin
if update(description)
begin
-- update cafe
-- set description =
-- (
-- select distinct(cate_name) from
-- inserted as i inner join category as c
-- on i.fk_cate = c.cate_id
-- )
-- where fk_cate in (select fk_cate from inserted)
update cafe
set description = ca.cate_name
from cafe cf
inner join category ca
on cf.fk_cate = ca.cate_id
inner join inserted i
on ca.cate_id = i.fk_cate
where cf.fk_cate = i.fk_cate
end
end
댓글 영역