帮我看哥删除触发器
//删除触发器,要出错,执行删除记录的时候,报错显示没有deleted表
create trigger delete_flds
on tablefields
for delete as
begin
update systables set fieldscount = fieldscount - 1
where systables.tablename = deleted.tablename
end
;
//增加触发器没有问题
create trigger insert_flds
on tablefields
for insert as
begin
update systables set fieldscount = fieldscount + 1
where systables.tablename = inserted.tablename
end
;
[解决办法]
create trigger delete_flds
on tablefields
for delete as
begin
update systables set fieldscount = fieldscount - 1 from deleted //加这里
where systables.tablename = deleted.tablename
end