Topic: Faire revenir Id a 0

Bonjour a Tous

J'ai besoin de votre aide

Apres avoir effacé le contenu d'une base je voudrai faire revenir  Id a 0.

Avant de commencer a saisir des nouveaux éléments.

Merci de votre aide

Niko

Re: Faire revenir Id a 0

Hi,
I'm guessing that you mean that you want to delete the contents of a table rather than the database (if you delete the entire database, all the IDs in the new database will start at 0 anyway).
If so, then after you have deleted the contents of your table, add this to your code;

sqlexecute('delete from sqlite_sequence where name = "mytablename"');

If, however, you DO want to delete the entire database, I would do it using a batch file that runs when your program closes.
Not sure why you need to do either?
Derek.

3 (edited by sparrow 2022-09-26 15:41:05)

Re: Faire revenir Id a 0

Hi Nikomax, hi Derek


OR


UPDATE SQLITE_SEQUENCE SET SEQ=0 WHERE NAME='table_name';

Re: Faire revenir Id a 0

Bonjour Derek Bonjour moineau

Merci de votre aide, j'ai compris la différence des deux.

Niko