The SP makes an update on the EmpAttendance table column SubDiario when the change in the table EmpSalary column SubDiario and it works, but when I try to trigger the sp "EXEC [dbo]. [sp_SubMensal_update] gives an error
Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32).
the SP
USE [MiniPayroll]
GO
/****** Object: StoredProcedure [dbo].[SubMensal_update] Script Date: 14-04-2021 15:46:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[SubMensal_update]
AS
BEGIN
update dbo.EmpAttendance set
EmpAttendance.SubDiario= EmpSalary.SubDiario
from dbo.EmpSalary
join EmpAttendance on EmpSalary.EmpId=EmpAttendance.EmpId
where EmpAttendance.time_registered > getdate() -1
END
The Trigger
USE [MiniPayroll]
GO
/****** Object: Trigger [dbo].[update_SubMensal] Script Date: 14-04-2021 16:32:20 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER TRIGGER [dbo].[update_SubMensal]
ON [dbo].[EmpAttendance]
AFTER INSERT,UPDATE,DELETE AS BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
EXEC [dbo].[SubMensal_update]
END
thanks