How to clear a dialog manually from the database - Portrait Dialogue

Product Feature: Databases

The Visual Dialogue provides an option to clear a dialog in the Execution mode.

This option may take time (in hours or days) in clearing the dialog if there are a huge number of participants processed in it (Say in Millions).

Therefore, to reduce the time, we can clear the dialogue manually by executing a script directly on the portrait system database.
These scripts vary from version to version, and can be made available upon request for your version of Dialogue and your Database.  

Some scripts will delete all records from the DLG_PARTICIPANT and relate tables all at once from one Dialog, or a list of Dialogs..
Some scripts will do the same thing, but in chunks.
Note: the ID of the Dialog(s) will have to be added to the script.

Some scripts will  truncate the records forever from the DLG_PARTICIPANT and DLG_PARTICIPANT_log tables.

A few things need to be taken care of before executing the scripts on the Database:
  1. As usual, it is always wise to begin by taking a backup of the database.
  2. Make sure that all the MH Dialogue services are stopped in the Microsoft service console.
  3. 1. As a good practice, take backup of the database and restore it to create a dummy database and then try these queries on the dummy database first. 

UPDATED:  May 17, 2018