Forums

Reset the id of a table cf_id

tamarteleco 17 Jun, 2010
Hi,

I would like to reset the cf_id of a ChronoConnectivity table. I have 3 rows, but because I was testing now a new row takes the cf_id number 73. I have access to the database...

where can I change the starting cf_id numbers?

Thanks.
nml375 17 Jun, 2010
Hi,
The cf_id is not assigned by ChronoForms, but by the MySQL-server (as it's an auto_increment INT). Thus, you'll have to tell the SQL-server to reset the counter; You'll find the information here: http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html

Cutting it short though, use a query like this:
ALTER TABLE tablename AUTO_INCREMENT = 1;

Just remember to change the table name to match your database table.

/Fredrik
tamarteleco 17 Jun, 2010
Thanks. It works perfect!

Regards.
tamarteleco 29 Jun, 2010
Hi Fredrik,

The query worked, but today a new form have been sent, and instead of getting cf_id = 5, the new one was saved with cf_id = 73, so something didn't work fine. Could it be the uid column?:
cf_id uid recordtime
4 IZTAzM2ZkYjExZjFm9e967695496bf1c35b540586da773237 2010-06-17 - 16:36:11
3 INDM5MmU2MzFkYTM44204ee387451ef33823e8311c6ed49bc 2010-06-02 - 09:57:29
2 IODM5NmU4MWE2NDhi5ed1506c33c629e3f55acb6760ea9f80 2010-05-31 - 09:49:06
1 IN2I2NmI0ZmQ0MDFhf6ebbb9104029ffe438bad092262f1dd 2010-05-28 - 19:34:28
73 IZjcwODRjOGRjNzI19ed2f0afbc6c3a5afdc469d617927573 2010-06-28 - 18:36:34
nml375 01 Jul, 2010
Hi,
No, neither ChronoForms nor ChronoConnectivity assigns any value to cf_id when adding a new record. This is solely handled by the SQL-server. The other columns in the table should generally not have any affect on the generated id. In the end, cf_id can only be trusted to be unique. Most of the times, it's in a sequential order, but this cannot be guarantee'd.

/Fredrik
tamarteleco 01 Jul, 2010
Thanks,
I throwed the query:
alter table `bcc_chronoforms_improvementidea_form` AUTO_INCREMENT=7 

again. Lets see if the next row is 8, or 75...

Thanks.
This topic is locked and no more replies can be posted.