有一个主表M,子表D,更新的目的表T
做了一个主表的修改型触发器,当修改主表字段State时,将子表D的数据全部新增到T中去
现在的问题是:在SqlServer中执行正确,但在Delphi中报如此错误:
Key column information is insufficient or incorrect. Too many rows were affected by update
应该是批量更新的问题,子表数据超过一条才会报错
触发器中的新增是这样写的
insert into T(...)
select ... from Inserted I inner join D on I.ID=D.ID