OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Setting a base line for AutoValue?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base
View previous topic :: View next topic  
Author Message
Kingwill
Newbie
Newbie


Joined: 28 Jul 2007
Posts: 2
Location: Norwich, England

PostPosted: Sat Jul 28, 2007 1:03 am    Post subject: Setting a base line for AutoValue? Reply with quote

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
View user's profile Send private message
DrewJensen
Super User
Super User


Joined: 06 Jul 2005
Posts: 2599
Location: Cumberland, MD

PostPosted: Sat Jul 28, 2007 5:09 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
nigelduffin
General User
General User


Joined: 30 Jun 2007
Posts: 22
Location: Teddington, England

PostPosted: Sat Jul 28, 2007 6:02 am    Post subject: Reply with quote

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
View user's profile Send private message
Kingwill
Newbie
Newbie


Joined: 28 Jul 2007
Posts: 2
Location: Norwich, England

PostPosted: Sat Jul 28, 2007 11:53 am    Post subject: Reply with quote

Did the trick!

Thanks for the clear and quick advice.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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