Suzi167
July 8th, 2008, 03:21 PM
Hi ,
I have a trigger on a table in SQL Server that currenlty executes a stored procedure each time an UPDATE is done to the table.
Here is the body of the trigger:
CREATE TRIGGER EMPLOYEE_TRIGGER
ON dbo.Employees
AFTER UPDATE
AS
EXEC PROCEDURE_FOR_TRIGGERS'200','200','200'
I need to change it though to execute only if the Title column Changed its value. So I need to compare the new and the old values of the Title column in the table and I need the trigger to go through all the records in the table.
In Oracle the syntax is as follows:
IF :NEW.Title<> :OLD.Title THEN
PROCEDURE_FOR_TRIGGERS(:NEW.PROC_ID,:NEW.SAMPLE_ID,:NEW.Title);
END IF;
Is there a built in functionality like that in SQL Server or shold I use Temp Tables?
Thanks
Susan
I have a trigger on a table in SQL Server that currenlty executes a stored procedure each time an UPDATE is done to the table.
Here is the body of the trigger:
CREATE TRIGGER EMPLOYEE_TRIGGER
ON dbo.Employees
AFTER UPDATE
AS
EXEC PROCEDURE_FOR_TRIGGERS'200','200','200'
I need to change it though to execute only if the Title column Changed its value. So I need to compare the new and the old values of the Title column in the table and I need the trigger to go through all the records in the table.
In Oracle the syntax is as follows:
IF :NEW.Title<> :OLD.Title THEN
PROCEDURE_FOR_TRIGGERS(:NEW.PROC_ID,:NEW.SAMPLE_ID,:NEW.Title);
END IF;
Is there a built in functionality like that in SQL Server or shold I use Temp Tables?
Thanks
Susan