Barbara Duprey wrote:
Simone Paoletti wrote:
How do I clear the numerator automatic (id) of a data base?
thanks
It sounds as if you may have allowed Base to create an ID field as a
primary key, as it suggests when you define a table without such a
field. Why do you want to clear it? If there is a field in the data of
the table that you want to use as the primary key, you can just select
the other field as the primary key and delete the ID field:
Hi Simone, Barbara
I was thinking along the same lines as Barbara, which is - that you are
referring to auto_increment integer field used as a Primary Key.
However, you do not need to drop the field in order to reset the value.
( that will work of course )
You can perform this function using the ALTER TABLE command.
For instance - if my table is named "Table1" and the PK field is named
"ID" I can use this command:
ALTER TABLE "Table1" ALTER COLUMN "ID" RESTART WITH 0
To do this:
Open the database
Open the SQL window ( Tools>SQL)
Enter the command
Click on the "Execute" button.
To be clear - if you have records in your database then this is not a
good idea, as it will generate clashes on the PK field data and when
this happens the new record will not be written. BUT if you emptied your
table and simply want to start the Auto_Increment value again, then this
will do the trick.
For the actual documentation on ALTER TABLE you can refer to the HSQLdb
site:
http://hsqldb.org/web/hsqlDocsFrame.html
HTH
Drew
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]