You are here: Re: Cant alter data in primary key fields « All PHP « IT news, forums, messages
Re: Cant alter data in primary key fields

Posted by jj on 01/09/06 18:09

Thanks for the reply.

My problem isnt that there are duplicates. My table is as simple as it
possibly gets:


table name : UPS

--------------
discount(PK)
--------------
0.33
--------------

It only has one value in the entire table.

Now if I try to alter the 0.33 to any value it just reverts back to the
0.33. No error is given at all either.




"J.O. Aho" <user@example.net> wrote in message
news:42ffntF1inojhU1@individual.net...
> jj wrote:
> > Hi all
> >
> > All of a sudden I cant alter values in rows where the column is a
primary
> > key. It just reverts to the old value that was there if I try to make
any
> > changes.
> >
> > If I try changing a value on any other (non-primary key) column , it
changes
> > the data no problem.
>
>
> Control that the value you change to aren't already in the table
>
> eg table Simple
> Id Name
> A Carl
> B Buddy
> C Cheng
> D David
> E Earl
>
> ID is the primary key.
>
> UPDATE Simple SET Id='C' WHERE Id='A';
>
> This will fail as there already is a row with the Id=C (Cheng) and with
the
> primary key there is only allowed to be one of each.
>
> While the Name isn't a primary key, you could do
>
> UPDATE Simple SET Name='Cheng' WHERE Id='A';
>
> As there aren't any restrictions.
>
>
> //Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация