我现在的问题就是 for update as if update(anum) begin update B set bnum='1' where b.id= ? --这里的?不会了。难道用@aaaaend
不好意思,问题问的太烂了。 最主要是后面的a.id不确定。一定要是接受到的a.id才可以更新表B
create table taba (id int,aname varchar (10),amun varchar (10))create table tabb (id int,bname varchar (10),bmun varchar (10)) insert into taba select 1,'aa1','11' union select 2,'aa2','22' insert into tabb select 1,'bb1','222' union select 2,'bb2','333' CREATE TRIGGER [TRI_up] ON [taba] FOR UPDATE AS if update (amun)update 表b set bmun='1' from tabb b inserted c where b.id=c.id
但是A.id是接受到的。也就是变量。
b.id是怎么得到666
其实我是想这样。有个bit字段。
只有0和1,
做触发器。只要调用了就把0变成1。
谢谢!
表b.id 更新为多少?
for update
as
if update(anum)
begin
update B set bnum='1' where b.id= ? --这里的?不会了。难道用@aaaaend
最主要是后面的a.id不确定。一定要是接受到的a.id才可以更新表B
insert into taba
select 1,'aa1','11' union
select 2,'aa2','22'
insert into tabb
select 1,'bb1','222' union
select 2,'bb2','333'
CREATE TRIGGER [TRI_up] ON [taba]
FOR UPDATE
AS
if update (amun)update 表b set bmun='1'
from tabb b inserted c where b.id=c.id
所以是越看越不明白.
FOR UPDATE
AS
if update (amun)update 表b set bmun='1'
from tabb b,inserted c where b.id=c.id