[Solved] Cannot add Primary Key

Creating tables and queries
Post Reply
nickblitz
Posts: 22
Joined: Tue Sep 25, 2012 4:29 am

[Solved] Cannot add Primary Key

Post by nickblitz »

Hi there,

I am having problems adding a primary key to this people table. I have set the primary key and saved but it just does not stick. . i went back into the table and the pk is still not there.

PLease help.

Thanks.
Last edited by nickblitz on Fri Oct 12, 2012 2:46 am, edited 2 times in total.
Openoffice 3.4.1 on windows 7
User avatar
Sliderule
Volunteer
Posts: 1279
Joined: Thu Nov 29, 2007 9:46 am

Re: Cannot add Primary Key

Post by Sliderule »

nickblitz wrote:I am having problems adding a primary key to this people table. I have set the primary key and saved but it just does not stick.
But, you have NOT told us what you want the Primary Key to be in the table, therefore, it is difficult to help. Put another way, ¿ ¿ ¿ which field, or, fields will make each record in the table "People" unique ? ? ?

I have ADDED a new field, I named it "PeopleID" and, assigned it a field type of INTEGER, and, constructed it as GENERATED BY DEFAULT AS IDENTITY (START WITH 1) . . . this way . . . you can have more than one person with the same "Name" ( a possibility ) and the database engine ( HSQL ) will assign a unique integer "PeopleID" value when a new record is created, starting with 1 :super: .

WARNING: I just added the new field to your table "People" . . . BUT . . . I did not touch ( even look / open ) any forms or queries ( if any exist ). It is your responsibility to make these changes if needed. :bravo:

I hope this helps, please be sure to let me / us know.

Sliderule

Thanks to add [Solved] in your 1st post Subject (edit button top right) if this issue has been resolved.

.
User avatar
DACM
Volunteer
Posts: 1138
Joined: Tue Nov 03, 2009 7:24 am

Re: Cannot add Primary Key

Post by DACM »

nickblitz wrote:I am having problems adding a primary key...I have set the primary key and saved but it just does not stick.
Looks like Sliderule has you all setup. :)

I'll mention that this is a known bug in the Base GUI. So you may find these links handy or informative for future reference:
http://user.services.openoffice.org/en/ ... 78#p187178
http://user.services.openoffice.org/en/ ... 19#p247019
http://www.oooforum.org/forum/viewtopic ... 884#398884
...
AOO 4.1.x; LO 4.2.x; Windows 7/8 64-bit
Warning: Avoid embedded databases --> Solution: Adopt a portable 'split database' folder
Soli Deo gloria
nickblitz
Posts: 22
Joined: Tue Sep 25, 2012 4:29 am

Re: Cannot add Primary Key

Post by nickblitz »

thanks!! :) :) :)
Openoffice 3.4.1 on windows 7
Post Reply