[Solved] Cannot add Primary Key

Creating tables and queries

[Solved] Cannot add Primary Key

Postby nickblitz » Tue Oct 02, 2012 11:20 am

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
nickblitz
 
Posts: 22
Joined: Tue Sep 25, 2012 4:29 am

Re: Cannot add Primary Key

Postby Sliderule » Tue Oct 02, 2012 5:38 pm

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.

.
Attachments
ASPAC.odb
Contains a Primary Key for table "People" of "PeopleID"
(66.56 KiB) Downloaded 108 times
User avatar
Sliderule
Volunteer
 
Posts: 1159
Joined: Thu Nov 29, 2007 9:46 am

Re: Cannot add Primary Key

Postby DACM » Tue Oct 02, 2012 6:27 pm

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/forum/viewtopic.php?p=187178#p187178
http://user.services.openoffice.org/en/forum/viewtopic.php?p=247019#p247019
http://www.oooforum.org/forum/viewtopic.phtml?p=398884#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
User avatar
DACM
Volunteer
 
Posts: 1138
Joined: Tue Nov 03, 2009 7:24 am

Re: Cannot add Primary Key

Postby nickblitz » Wed Oct 03, 2012 10:00 am

thanks!! :) :) :)
Openoffice 3.4.1 on windows 7
nickblitz
 
Posts: 22
Joined: Tue Sep 25, 2012 4:29 am


Return to Tables & Queries

Who is online

Users browsing this forum: No registered users and 2 guests