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!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s