Ask Your Question

auto-increment field

asked 2020-06-06 17:05:07 +0100

Tripple Delta gravatar image


How can I set an auto-increment field in Base to start with 1 and not zero?


edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2020-06-06 18:05:58 +0100

Ratslinger gravatar image


Please include basic information when posting. Database type can be critical. Here is for HSQLDB embedded to reset to any value an auto-increment field:

alter table TABLE_NAME alter FIELD_NAME restart with 1;

Run this from menu Tools->SQL on an empty table.

edit flag offensive delete link more


How can I do this with a brand new HSQLDB embedded database where I want to add an ID field? Do I have to run this SQL before I start?

Tripple Delta gravatar imageTripple Delta ( 2020-06-06 18:09:12 +0100 )edit

Has nothing to do with a new database This has to do with each individual table. Once a table is defined then simply run this SQL (with your field & table names).

Also as eluded to, this is used to set the next increment number to any starting point. For example if numbers are to start at '300'.

Ratslinger gravatar imageRatslinger ( 2020-06-06 18:18:51 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-06-06 17:05:07 +0100

Seen: 91 times

Last updated: Jun 06 '20