defining primary key after table creation

User, date Message
Written by landisd
7 years ago
Category: General
7 posts since Sun, 06 May 07
How do I, using Heidi, define a field as a primary key after the table has already been created.


Dan Landis
Written by siMKin
7 years ago
104 posts since Sun, 01 Apr 07
right click any of the column-names and choose the option 'manage indexes'

see also:
Written by rando
7 years ago
1 posts since Sat, 29 Sep 07
Same problem. I have created a new field which I first want to be the primary key and then autoincrement field.

When I try to set the field as primary key, I get twice an error message
data truncated for column 'my field' at row 1.

What is wrong?
Written by jan
7 years ago
15 posts since Wed, 15 Aug 07
just remember, that the primary-key is unique. so when you want to add this key, the data in this row has to be unique.

select id, count(*) from table group by id having count(*) <> 1

gives you all your dups.

the primary-key has nothing to do with the auto-increment. but you can only set the auto-increment to an primary-column. so first, add the new column, then change/add the primary key to this column and then edit the column and set the auto-increment.

Please login to leave a reply, or register at first.