Quite often it is necessary to make sure that only one copy of the package is being executed at a given time For example, the package below is being executed every 2 minutes but it might take more than 2 minutes to complete The package is creating text files it is not possible to open the same file twice for writing. So we have to check if the same package is being executed and if not abort the execution
This can be easily done by using SQL Data Check Action
SQL Data Check uses SQL scripts to check data in the database. For example, the user may write the following SQL:
Select count(*) from table
Execution will be successful if the value of the first field of lookup query is more than 0 Execution will fail if the value of the first field of lookup query is equals to 0 or less than 0 or the field type is not numeric.
Using the same approach we can query QUEUE and QUEUE_ACTIONS tables
Select Count(*) as RC from ( select OBJECT_ID from QUEUE WHERE STATUS='R' and OBJECT_ID=3924 union all select OBJECT_ID from QUEUE_ACTIONS WHERE STATUS='R' and OBJECT_ID=3924 )