create tigger tri_b on b
for update
as
if update(NAMETYPE)update a set TIMETYPE=1 from a inner join instered as i on a.id=i.idif @@rowcount=0insert into CTEMP(ID) select id from instered
for update
as
if update(NAMETYPE)update a set TIMETYPE=1 from a inner join instered as i on a.id=i.idif @@rowcount=0insert into CTEMP(ID) select id from instered
消息 170,级别 15,状态 1,第 1 行
第 1 行: 'tigger' 附近有语法错误。
消息 140,级别 15,状态 1,第 4 行
只能在 CREATE TRIGGER 语句内部使用 IF UPDATE。
for update
as
if update(NAMETYPE)update a set TIMETYPE=1 from a inner join instered as i on a.id=i.idif @@rowcount=0insert into CTEMP(ID) select id from instered
for update
as
BEGIN
if update(NAMETYPE)
begin
update a set TIMETYPE=1 from a inner join instered as i on a.id=i.id
end
if @@rowcount=0
insert into CTEMP(ID) select id from instered
END
怎么知道更新哪条数据呢?
定义一个变量然后怎么赋值?