| View previous topic :: View next topic |
| Author |
Message |
Kingwill Newbie

Joined: 28 Jul 2007 Posts: 2 Location: Norwich, England
|
Posted: Sat Jul 28, 2007 1:03 am Post subject: Setting a base line for AutoValue? |
|
|
Hi
I'm a new convert to OpenOffice having just recently installed 2.2.
I've been finding my way around the Base application but I'm afraid I've been using, excuse my language, Access for too long that I'm finding it a little difficult at the moment.
I've established how to set the primary key and set the autovalue to yes but one thing I'd like to know is can you set the autovalue to start incrementing from a set baseline number, say 1000 rather than starting at 0 which is not always appropriate.
If you can how do you do it? |
|
| Back to top |
|
 |
DrewJensen Super User


Joined: 06 Jul 2005 Posts: 2599 Location: Cumberland, MD
|
Posted: Sat Jul 28, 2007 5:09 am Post subject: |
|
|
Hi Kingwill
| Quote: | | I've established how to set the primary key and set the autovalue to yes but one thing I'd like to know is can you set the autovalue to start incrementing from a set baseline number, say 1000 rather than starting at 0 which is not always appropriate. |
There are a number of things that can be done with the 'included' database engine, HSQLdb, via the SQL window that are not available in the GUI table designer. This is one of them
If you have used the New Table Wizard, or the Table Designer, to create a table with an auto increment field and want to set the starting value for the field use the Alter Table command.
| Code: | ALTER TABLE <tablename> ALTER COLUMN <columnname>
RESTART WITH <new sequence value> |
OK, so if you have a table named Table1 and a column named ID that you want to set the next value for to 1000 you would do the following.
Open the SQL window [ Tools>SQL]
Enter the alter table command
| Code: |
ALTER TABLE "Table1" ALTER COLUMN "ID"
RESTART WITH 1000 |
Click on the execute button.
That's it.
FYI, this is also possible using the CREATE TABLE command, but I will leave that to your own exploration.
This, and the other available options, is discussed in the HSQL users manual available at http://hslqdb.org
HTH
Drew _________________ Blog - http://baseanswers.spaces.live.com/ |
|
| Back to top |
|
 |
nigelduffin General User

Joined: 30 Jun 2007 Posts: 22 Location: Teddington, England
|
Posted: Sat Jul 28, 2007 6:02 am Post subject: |
|
|
| Quote: | | This, and the other available options, is discussed in the HSQL users manual available at http://hslqdb.org |
Slight typo with this, in case you were wondering - it's http://hsqldb.org/.
And, yes, this manual is very useful for using the HSQLDB included with Base.
Nigel |
|
| Back to top |
|
 |
Kingwill Newbie

Joined: 28 Jul 2007 Posts: 2 Location: Norwich, England
|
Posted: Sat Jul 28, 2007 11:53 am Post subject: |
|
|
Did the trick!
Thanks for the clear and quick advice. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|