Tools
Delete all tickets from the database to reset ticket numbering
This article describes how to reset the ticket numbering by deleting all tickets from the database.
First published date
Last published date
Overview
This article describes how to reset the ticket numbering by deleting all tickets from the databse. Resetting ticket numbering in Web Help Desk (WHD), such as when you need to reset ticket numbering to start at 1, may require ticket deletion.
Deleting the ticket is required only if you want to move the ticket number backwards. If you want to increase the ticket number, deleting the ticket is not required.
Product section
Resolution
Warning: Perform a full database backup before you delete anything from the database.
See Database Migration Options for information on backing up your WHD database.
For PostgreSQL backup details, see Chapter 24. Backup and Restore (© 1996-2018 The PostgreSQL Global Development Group, available at https://www.postgresql.org/, obtained on November 20, 2018) in the PostgreSQL 9.2.6 Documentation.
For SQL Server backup details, see Back Up and Restore of SQL Server Databases (© Microsoft 2018, available at https://www.microsoft.com/en-us/, obtained on November 20, 2018).
.
For MySQL backup details, see Chapter 1. Backup and Recovery (© 2018, Oracle Corporation and/or its affiliates, available at https://dev.mysql.com/, obtained on November 20, 2018) from MySQL Backup and Recovery documentation.
Delete all rows from database tables
This action cannot be undone. Verify that you have performed a full backup before deleting anything from the database.
Use the following SQL syntax:
DELETE from [table name];
The following are tables from which to delete rows before removing tickets.
You must delete these database table rows *before* performing any further steps, so ignore the warning and remove all rows for each table.
TKT_APP_STEP_CLIENT_VOTE
TICKET_APPROVAL_STEP
TICKET_APPROVAL
TICKET_ATTACHMENT
TICKET_TAX_RATE
TICKET_STATUS_TIME
TICKET_CUSTOM_FIELD
TICKET_BULK_ACTION
EMAIL_DATA_OBJECT
HISTORY_ENTRY
TECH_NOTE
CLIENT_NOTE
JOB_TICKET_PART
JOB_TICKET_ASSET
LVL_ASSIGNMENT_HIST_ENTRYDelete all tickets from the database
After you clear out the tables listed above, use the following SQL syntax for deleting tickets:
DELETE from JOB_TICKET;
Reset the ticket numbering
Reset the ticket counter to the desired value, which is shown below as:
<starting><starting_number/></starting>
The counter can begin at any number you choose, using values going forwards or backwards. Use one of the following methods to reset ticket numbering.
FrontBase
Issue the following SQL:
Set UNIQUE=<starting_number><starting_number><starting/> for JOB_TICKET;
MySQL, SQL Server, OpenBase
- Edit the EO_PK_TABLE.
- Locate the row with NAME='JOB_TICKET';
-
Set the Primary Key by running the SQL QUERY to reset the ticket number to 0 as an example starting number. You can use a different starting number.
UPDATE EO_PK_TABLE SET PK='0' WHERE NAME='JOB_TICKET';
PostgreSQL
Use the following SQL syntax:
ALTER SEQUENCE job_ticket_seq RESTART WITH <starting_number>;
Disclaimer: Please note, any content posted herein is provided as a suggestion or recommendation to you for your internal use. This is not part of the SolarWinds software or documentation that you purchased from SolarWinds, and the information set forth herein may come from third parties. Your organization should internally review and assess to what extent, if any, such custom scripts or recommendations will be incorporated into your environment. You elect to use third-party content at your own risk, and you will be solely responsible for the incorporation of the same if any.