Resetting tracking ID no back to zero

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
chrisdevelop
Posts: 23
Joined: Thu Feb 01, 2018 2:27 pm

Resetting tracking ID no back to zero

Post by chrisdevelop »

Script URL:
Version of script: 343
Hosting company: caerta Hosting
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:

Write your message below:
I have to upgrade one of the sites to the latest, but how can i reset the 1st column called ID so it will start at No 1 when a new ticket is made. All existing tickets are being deleted so we need to go back to No 1 when a new ticket is made. Once all tickets are deleted if a new one is made it does not put 1 it puts 27 which was the last ticket generated.
shddcit
Posts: 65
Joined: Wed Mar 30, 2022 3:54 pm

Re: Resetting tracking ID no back to zero

Post by shddcit »

chrisdevelop wrote: Thu Sep 11, 2025 2:39 pm Script URL:
Version of script: 343
Hosting company: caerta Hosting
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:

Write your message below:
I have to upgrade one of the sites to the latest, but how can i reset the 1st column called ID so it will start at No 1 when a new ticket is made. All existing tickets are being deleted so we need to go back to No 1 when a new ticket is made. Once all tickets are deleted if a new one is made it does not put 1 it puts 27 which was the last ticket generated.

If you are deleting all tickets, it's easier to delete the database itself, recreate it, and install HESK again.
However, if you want to keep all the previously created settings, then this (directly via SQL) is the only way.

If you need to reset the auto-increment in databases, use the following commands in your chosen database:

MySQL/MariaDB:

Code: Select all

ALTER TABLE table_name AUTO_INCREMENT = 1;
PostgreSQL:

Code: Select all

ALTER SEQUENCE table_name_id_seq RESTART WITH 1;
SQL Server:

Code: Select all

DBCC CHECKIDENT ('table_name', RESEED, 0);
SQLite:

Code: Select all

DELETE FROM sqlite_sequence WHERE name='table_name';
Klemen
Site Admin
Posts: 10211
Joined: Fri Feb 11, 2005 4:04 pm

Re: Resetting tracking ID no back to zero

Post by Klemen »

Just to add: if you have phpMyAdmin (most hosting companies provide it), you can open the hesk_tickets table, then on the "Operations" tab you can edit the "AUTO_INCREMENT" value to 1 and click "Go"
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Post Reply