Whenever INSERT is happened in the CUSTOMER table,I need to call the \"StoredProcedure1\"and UPDATE is happend in the CUSTOMER table,I need to call the \"
The easiest way to solve this problem would be to have two triggers, one for the insert and one for the update.
CREATE TRIGGER InsertNotifications ON CUSTOMER
FOR INSERT
AS
BEGIN
DECLARE @recordId varchar(20);
set @recordId= new.Id;
//if trigger is insert at the time I call to SP1
EXEC StoredProcedure1 @recordId
END
CREATE TRIGGER UpdateNotifications ON CUSTOMER
FOR UPDATE
AS
BEGIN
DECLARE @recordId varchar(20);
set @recordId= new.Id;
//if trigger is Upadeted at the time I call to SP2
EXEC StoredProcedure2 @recordId
END