4 messages in com.mysql.lists.mysqlPrimary Key trouble
FromSent OnAttachments
Andy Harrison21 Mar 1999 10:16 
sin...@beotel.yu21 Mar 1999 11:01 
Christian Mack22 Mar 1999 06:05 
Andy Harrison22 Mar 1999 11:47 
Subject:Primary Key trouble
From:sin...@beotel.yu (sin@beotel.yu)
Date:03/21/1999 11:01:47 AM
List:com.mysql.lists.mysql

Andy Harrison writes:

I'm working on getting Access to use my mySQL database and I've had a lot of success. But now I'm stuck on something that I just can't knock. In order for the myAccess add-in to work 100%, you have to have a primary key defined. No problem, I had it working fine. Access could enter data, no sweat.

After I got it working, I went and made some changes and basically recreated the mySQL database I had going. Now it's time for the primary key. I'm keying off of a char(50) field called simply Name. There are no duplicate values in this. I combed the entire table several times ensuring there were no dupes, plus had someone else comb through it as well. There are 552 rows of data and I'm 110% certain that no two Name fields contain the same data.

Now, when I go to create the primary key on the name field, I modify the Name field appropriately, click the Alter Table button, and I get:

Executing "alter table ip add primary key (Name(30)) " -> * ERROR * Can't write, duplicate key in table 'A-280'

(the reason it says (Name(30)) in this example is because I was trying a smaller key to see if that helped)

I'm not sure quite what that error message means. I looked at row 280 to see if that contained a dupe and it didn't.

Can anyone help me out? Thanx!

Hi!

First of all, if you create index on the first N chars, you should look for dups in the first N chars, not entire field.

Next, if your field is not binary, upper and lower case amounts to the same char !

Sinisa

+---------------------------------------------------------------------+ | TcX ____ __ _____ _____ ___ == mys@tcx.se | | /*/\*\/\*\ /*/ \*\ /*/ \*\ |*| Sinisa Milivojevic | | /*/ /*/ /*/ \*\_ |*| |*||*| mailto:sin@grmec.com | | /*/ /*/ /*/\*\/*/ \*\|*| |*||*| Belgrade | | /*/ /*/ /*/\*\_/*/ \*\_/*/ |*|_____ Serbia | | ^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^ | | /*/ \*\ Developers Team | +---------------------------------------------------------------------+