0

as the thread name

$query2= "alter table employee_leave_quota auto_increment= LAST_INSERT_ID()";

That is my query to reset auto_increment in my table, but it show error..

anybody know how to do it?

4
Contributors
6
Replies
7
Views
5 Years
Discussion Span
Last Post by pritaeas
0

so its not possible to recover the primary key that is already deleted?

-1

in any database, if primary key is once deleted, it can never be used again. To reset the primary key, you have to TRUNCATE your table which will result in loss of all the data. So i will not suggest you to reset the table

0

usually you do not delete data from a table,
usually the data is marked deleted, in a table column(type =date or timestamp) for that purpose, and the "deleted" item is excluded from other reports
this is to ensure trace-ability,
deleted items can screw up later work

0

in any database, if primary key is once deleted, it can never be used again. To reset the primary key, you have to TRUNCATE your table

NOT TRUE. The query above works fine, just the last_insert_id won't. Even in MSSQL you can reset an identity column.

Edited by pritaeas

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.