Page 1 of 1

no primary keys?!

Posted: Fri Nov 30, 2007 5:18 am
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

Re: no primary keys?!

Posted: Fri Nov 30, 2007 1:33 pm
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?

Re: no primary keys?!

Posted: Sat Dec 01, 2007 2:49 am
by inbhm
I do not.

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

what should I do?

Re: no primary keys?!

Posted: Mon Dec 03, 2007 2:09 am
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.

Re: no primary keys?!

Posted: Fri Dec 07, 2007 6:11 am
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?

Re: no primary keys?!

Posted: Sun Dec 09, 2007 10:53 am
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

Re: no primary keys?!

Posted: Wed Dec 19, 2007 6:53 am
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.

Re: no primary keys?!

Posted: Wed Dec 19, 2007 8:46 am
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.