I have a single step job that executes a stored procedure. I would like get the date of the last successful job execution time so that I can just update a delta instead of the whole set of data.
Right now I have the job setup to run once every day, so I have a default parameter that if it's null I set it to GETDATE() - 1 so I'm still updating a delta but what I'd like to do is set the date to the last successful execution of the job.
exec dbo.usp_UpdateFrom @LastSuccessfulExecutionTime
Current procedure is something like
CREATE PROCEDURE dbo.usp_UpdateFrom
@FromDate datetime = NULL --would like to pass last successful execution time of the job
AS
IF @FromDate IS NULL
SET @FromDate = GETDATE() - 1
-- do stuff
END
No comments:
Post a Comment