Deleting expired tasks in the queue

Overview

You want to delete a list of tasks that are expired and are still shown in the queue.

 

Information

Deleting expired tasks in the queue involves database modification scripts that might damage your database and, in consequence, your data and the product.

If you want to proceed with the queries mentioned in the following section, please make sure you back up your entire database, and more precisely, the dbo.Tasks table, which can be found in the BANK DB of the customer, because once you execute the queries listed below, the data will be lost and will be unrecoverable. You can use the method described in the Backing Up Tables for Security KB Article for this purpose.

 

Input information

To get these records eliminated from the database, you must first reunite the following information:

  • The name of the queue where all these records exist. (it will be called <NOTQ>)
    If you want to eliminate records only from the "DDA Queue" queue and the "Investments" queue, then provide both names.

  • The date of expiration of the records will be eliminated. (it will be called <DOE>)
    If you want to eliminate all the records that expired for February the 5th, then provide this date so we can build the query properly.

 

Query to execute

Now that we have what we need, we can start our own research. To do so, let's check all the records that belong to the aforementioned queues:

Select Queue_ID 
from Queue where
Queue_Name in (<NOTQ>);

In our case, it would be:

Select Queue_ID 
from Queue where
Queue_Name in ('DDA Queue','Investments');

It should show all the records in the queue(s). Now, let's match all these results with the Tasks table, where we want to delete the records:

Select * 
from Tasks
where Queue_ID in
(
select Queue_ID
from Queue where
Queue_Name in (<NOTQ>);
)
and Due_Date < <DOE>

In our example, it would be:

Select * 
from Tasks
where Queue_ID in
(
select Queue_ID
from Queue where
Queue_Name in ('DDA Queue','Investments');
)
and Due_Date < '2021-02-05'

That is enough to get ALL records that would be deleted.

If you are able to confirm that this is the same list of records you want to get rid of, then you can modify a bit that the last query adding the DELETE sentence, as shown in the following example:

Delete from Tasks 
where Queue_ID in
(
select Queue_ID
from Queue where
Queue_Name in (<NOTQ>);
)
and Due_Date < <DOE>

In our example, it would be:

Delete from Tasks 
where Queue_ID in
(
select Queue_ID
from Queue where
Queue_Name in ('DDA Queue','Investments');
)
and Due_Date < '2021-02-05'

This last query is the query that must be used to delete ALL the records that exist in the DDA Queue and Investments queues, with an expiration (due) date under February the 5th, 2021.

Adapt this query based on the explanation previously given to your needs, to delete the list of records you want to delete.

 

Contacting Support

If you want support to execute this backend modification on your behalf, please contact the Support staff and provide them with the following information regarding the case:

  • The name of the queue(s) where all these records exist.
    The date of expiration of the records will be eliminated. 
  • Any other relevant information related to the records you want to delete, which can be found in the queue table.

A customer support representative will contact you back with the result of the execution of the aforementioned query.

<supportagent>

Agents only

If you are contacted by a customer with this type of request, make sure you do the backup of the dbo.Tasks table, by following the steps described in the Backing Up Tables for Security KB Article.

</supportagent>

Comments

0 comments

Please sign in to leave a comment.