cheryl9063
asked on
SQL update trigger that kicks off a job
How do you write an update trigger that on update of a record a job get executed?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
CREATE TRIGGER [TU_Clients] ON [dbo].[Clients]
AFTER UPDATE
AS
BEGIN
-- stop the recursive trigger from firing more than once ...
IF ((SELECT TRIGGER_NESTLEVEL()) > 1 )
BEGIN
RETURN
END
IF UPDATE(ClientName)
BEGIN
--start job here
EXEC msdb.dbo.sp_start_job @job_name = 'Put Your Real Job name here'
END
END