select @TMP=count(*) from inserted where inserted.bno=books.bno ;
UPDATE books SET quantity=quantity-@TMP
from books inner join inserted
where books.bno=inserted.bno 这里应该把where改成on,但改了还是同样的错误报出
UPDATE books SET quantity=quantity-@TMP
from books inner join inserted
where books.bno=inserted.bno 这里应该把where改成on,但改了还是同样的错误报出
create trigger trg_borrow after insert
on borrow
as
begin
declare @TMP int
select @TMP=count(*) from new where new.bno=books.bno ;
UPDATE books SET quantity=quantity-@TMP
from books inner join new
where books.bno=new.bno
end
create trigger trg_borrow after insert
on borrow
as
begin
declare @TMP int
select @TMP=count(*) from new where new.bno=books.bno ;
UPDATE books SET quantity=quantity-@TMP
where books.bno=new.bno
end