use account
go
create table expence1(id int not null identity,prodID int,
qty int,price money,cost int)
create trigger ex_tr
on expence for insert
as declare @pid int,@cost int,@pr int,@qt int
set @pid = (select prodID from inserted)
set @qt = (select qty from inserted)
set @pr = (select price from inserted)
set @cost = (@pr * @qt)
update expence
set @cost=@cost where id = @@identity
---test trigger---
insert into expence values (1,2,100)
select * from expence
after testing this trigger,it gave me error:
Column name or number of supplied values does not match table definition.
Pls can someone help me with the correct code.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks