写一个简单的触发器
表名 Order
列 id, type, value
当更新type时 判断如果更新后的type=1 则赋值当条记录的value=0
求前辈帮忙 ------解决方案--------------------
create trigger tri_order on order
for update
as
begin
if update(type)
update a set value=0 from order as a inner join instered as i on a.id=i.id where i.type=1
end
------解决方案--------------------
再修改一下,字母写错了,修改为inserted:
create trigger tri_order on [order]
for update
as
begin
if update(type)
update a set value=0 from [order] as a inner join inserted as i on a.id=i.id where i.type=1
end
------解决方案--------------------
create trigger tri_order on order
for update
as
begin
if update(type)
update a set value=0 from order as a inner join instered as i on a.id=i.id where i.type=1
end