![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hey all, Is there a way to determine that a package is currently executing? I have a job that executes a package every four hours and would like to be able to check on subsequent executions whether the package is already executing, in order not to execute again. Regards, Kevin |
#3
| |||
| |||
|
#4
| |||
| |||
|
#5
| |||
| |||
|
#6
| |||
| |||
|
|
Hi Allan and Michael, Thanks for the advice. I appreciate the options you've suggested. Allan, how do you handle cleanup of the table, in the case that the package ends unexpectedly? Unfortunately, Michael, the package can be executed outside of the job, and I'd like to make sure the it is protected in that case, as well. Tell me, if you don't mind, what you think of this idea: I'm planning to add an Execute SQL Task to each package that performs data manipulation. This task will execute sp_getapplock, creating an exclusive, |
|
What do you think? Regards, Kevin ----- \"Yuan Shao\" wrote: ----- Hi Kevin, Thanks for your post. According to your description, I understand that you have a job that executes a package every four hours. You want to determine if the package is executing. If I have misunderstood, please feel free to let me know. So far as I know, it seems there is not a built-in feature in SQL Server can meet your requirements. If you only want to determine if the package is executing, I think Allan's suggestions is good. However, I noticed that your package is executed in a job. In that case, can you please try to determine if the package is executing via checking the status of the job. To check the status of a job, you can use stored procedure sp_help_job. [@execution_status =] status Is the execution status for the jobs. status is int, with a default of NULL, and can be one of these values. @execution_status =1 will help you get the jobs which are executing. For example, Execute msdb..sp_help_job @execution_status = 1 For more information regarding sp_help_job, please refer to the article on SQL Server Books Online. Topic: "sp_help_job" Thanks for using MSDN newsgroup. Regards, Michael Shao Microsoft Online Partner Support Get Secure! - www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights. |
#7
| |||
| |||
|
#8
| |||
| |||
|
#9
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |