Solved

primary key confusion

Posted on 2013-06-27
3
287 Views
Last Modified: 2013-06-28
Hi,

In phpmyadmin I cant alter tables to get the primary key.  I want to set a primary key with autonumber and I know I check on a-I on creating a field .

If you see the img I have a field with PK that I cant undo the PK and I cant add a autonumber field as a PK as I get an error (need a PK)
mysql.docx
0
Comment
Question by:jagguy
3 Comments
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 39281685
Consider recreating the table.  You might write a little script to copy the data to the new table.
0
 
LVL 55

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 39281748
You shouldn't have to recreate the table.

What do you see when you edit (Change) the record - your version of PHPMyAdmin differs from the versions I am using

Have you tried running a query to do this
ALTER TABLE tbmod1 
   CHANGE `section` `section` INT(11) NOT NULL, 
   CHANGE `q1` `q1` INT(11) NOT NULL AUTO_INCREMENT,
   DROP PRIMARY KEY, 
   ADD PRIMARY KEY(`q1`)

Open in new window

Remember though before you can make a column a auto increment the column has to have unique values otherwise it will fail.
Also check if there are any relationships setup on the table which might be interferring.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39283611
Please use image files like JPGs for screen shots.  They will open in the browsers where 'docx' files require us to start up another program.  I usually won't do that and I haven't looked at your file.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question