我有两个触发器,它们看起来几乎相同,但差异很小
触发器 1
create trigger tr_EligebilityCheckSRmonth
on dbo.Clients
after INSERT,UPDATE
as
BEGIN
UPDATE Clients
SET
StatusID = 5
WHERE
ClientID IN (Select ClientID
from Clients c
join IncomeEligibility i
on c.HshldSize = i.HshldSize
where c.HshldSize= i.HshldSize
and c.AnnualHshldIncome >= i.SeniorMo
and StatusID in (1,2)
and c.CategCode = 'SR'
and MonthlyYearly ='month')
END
触发器 2
create trigger tr_EligebilityCheckSRyear
on dbo.Clients
after INSERT,UPDATE
as
BEGIN
UPDATE Clients
SET
StatusID = 5
WHERE
ClientID IN (Select ClientID
from Clients c
join IncomeEligibility i
on c.HshldSize = i.HshldSize
where c.HshldSize= i.HshldSize
and c.AnnualHshldIncome >= i.SeniorMo
and StatusID in (1,2)
and c.CategCode = 'SR'
and MonthlyYearly ='year')
End
当我像这样提交插入 ststamnet
INSERT INTO Clients (ClientID, LastName, FirstName, MidInitial, DOB, Address, Address2, City, Zip, Phone, CategCode, StatusID, Hispanic, EthnCode, LangID, ClientProxy, Parent, HshldSize, AnnualHshldIncome, MonthlyYearly, PFDs, WIC, Medicaid, ATAP, FoodStamps, AgencyID, RoutID, DeliveryNotes, AppDate, CertifiedDate, Notes)
VALUES (13542,'Test','Test',null,'1982-10-20','P.O. Box 5',null,'TEST',99999,'(907) 111-1111','SR',1, 0, 'W',1, null, null,3,1000000,'year',0,0, 1, 0,1,45, null,null,'2011-04-27', null,null);
它抛出错误
*消息 217,级别 16,状态 1,过程 tr_EligebilityCheckSRyear,第 28 行 超出
最大存储过程、函数、触发器或视图嵌套级别(限制 32)。*
我试图将它们组合在一个触发器中并使用 IF else 但没有任何疑问。如果我在系统中只有一个,它可以工作,但是当我有两个时,它会抛出错误。如何解决这个问题?我在这里查看其他帖子,但找不到任何有用的东西。