Monthly Archives: October 2013

Implementing timer in SSIS: Auto Stop Jobs

One can easily schedule job to run Daily\ Weekly\ Monthly but if you are asked to stop your job without any manual intervention at a particular time in a day because there are other planned activities that needs the server resources and this happens daily, what would you do? I was asked the same and hence I built small logic to implement the same which I am going to share with you.

Let’s begin:

I just introduced an ‘Execute SQL Task’ in my SSIS package and written following SQL Script:

WHILE (1=1)

BEGIN

IF(RIGHT(RIGHT(GETDATE(),12),6) = ‘2:29PM’)

EXEC msdb.dbo.sp_stop_job  N'<<Your job Name>>’ ;

END

 

That’s all I did and accomplished my task.

Enjoy!

Happy Coding!