no primary keys?!

Creating tables and queries
Post Reply
inbhm
Posts: 4
Joined: Fri Nov 30, 2007 5:12 am

no primary keys?!

Post by inbhm »

For some reason no option for primary keys show up anywhere - not in the table design view or the table wizard. in the help, it states, "

Primary Key

If this command has a check mark, the data field in this line is a primary key. By clicking the command you activate/deactivate the status. The command is only visible if the data source supports primary keys."

How do I make the data source support primary keys? (and why would anyone make a data source that doesn't?)

Thanks
User avatar
probe1
Volunteer
Posts: 277
Joined: Mon Oct 08, 2007 1:34 am
Location: Chonburi Thailand

Re: no primary keys?!

Post by probe1 »

in table design view (on table creation ONLY!),
right mouse-click on grey boundary, left-hand of row of field in question, the option is in po-up menu.

See it there?
Cheers
Winfried

DateTime2 extension: insert date, time or timestamp, formatted to your needs
inbhm
Posts: 4
Joined: Fri Nov 30, 2007 5:12 am

Re: no primary keys?!

Post by inbhm »

I do not.

I get : Cut, Copy, Delete, Insert Rows.

what should I do?
User avatar
probe1
Volunteer
Posts: 277
Joined: Mon Oct 08, 2007 1:34 am
Location: Chonburi Thailand

Re: no primary keys?!

Post by probe1 »

As you ask - you don't use the wizard (it's in table definition step).

The assignment "primary key" to a column is available only at table creation time. It's in the pop up menu from a row in the table definition grid.

Some data bases allow altering such table definition afterwards with a SQL statement: which DB engine do you use? And, btw: tell us OOo and OS versions, tnx.
Cheers
Winfried

DateTime2 extension: insert date, time or timestamp, formatted to your needs
inbhm
Posts: 4
Joined: Fri Nov 30, 2007 5:12 am

Re: no primary keys?!

Post by inbhm »

Thanks for your help - I still don't get it...

OOo 2.3.0
Win XP

Ok, from the top:
Run OOo Base from start menu.
[in database wizard]
choose "create new database"
click "next"
choose "No, do not register"
check "open database for editing"
not check "create table using table wizard"
click "finish"
name "test"
OK

[in database section]
click "tables" icon
[in Tasks section]
click "create table in design view"

[in test - OpenOffice.org Base: Table Design window]
right click slightly to the left of the green, right pointing triangle on the gray vertical strip
the menu reads "Delete; Insert rows"
exit that menu
Click in the field slightly to the right of the green triangle under "Field Name"
type "ID"
right click slightly to the left of the green triangle on the gray vertical strip again
The menu reads "Cut; Copy; Delete; Insert rows"

What am I doing wrong?
wurzel
Volunteer
Posts: 145
Joined: Sun Dec 09, 2007 10:39 am

Re: no primary keys?!

Post by wurzel »

Odd, because I can't reproduce this on my Mac Intel Tiger with OOo 2.3.0. If I do the exact same steps as you, I get the following choices in the context sensitive menu :

Copy
Cut
Delete
Insert lines
Primary Key

So, maybe you have a faulty installation.

Alex
inbhm
Posts: 4
Joined: Fri Nov 30, 2007 5:12 am

Re: no primary keys?!

Post by inbhm »

I feel so silly! In order to get the Primary key you must define it as a number.

DUH!

Thanks for your help anyway.
User avatar
DrewJensen
Volunteer
Posts: 1734
Joined: Sat Oct 06, 2007 9:01 pm
Location: Cumberland, MD - USA

Re: no primary keys?!

Post by DrewJensen »

You do not need to declare a primary key field as a number. It can be any data type.

IF you declare it as type INTEGER or BIG INTEGER then you can also declare it to be AUTO_INCREMENT but that is all.

You can have a CHAR or VARCHAR as a primary key also, it is up to you then to insure that the data added is unique that is all.
Former member of The Document Foundation
Former member of Apache OpenOffice PMC
LibreOffice on Ubuntu 18.04
Post Reply