At 4:36 PM -0700 3/13/07, jerad sloan wrote:
>thanks.
>i had an extra index setup for one of my fields...i deleted it and
>it started working as expected...but now the same thing is happening
>again.
>
>i'm getting the error
>"Duplicate entry
>'http://vids.myspace.com/index.cfm?fuseaction=vids.individual&vid'
>for key 2"
>
>when doing the following
>insert into tblvideoURL
>(videourl,userid,shortname,videourlcreated,videoURLcurrentstatus
>,xmltitle ) values
>('http://vids.myspace.com/index.cfm?fuseaction=vids.individual&videoid=1951753288',3,'MySpace',{ts
>
>'2007-03-13 15:04:01'},404 ,'Sporting Riff Raff - Absolutely Wasted
>(director unknown - hopefully Emily?!)' )
>
>here is the Show Create Table
>
<SNIP>
> PRIMARY KEY (`videourlID`),
> UNIQUE KEY `videourl` (`videourl`),
> KEY `videoURLcurrentstatus` (`videourlcurrentstatus`),
Key 2 is defined as unique; thus, the error message says you're
inserting a record where videourl duplicates an existing record.
Solutions:
(1) don't do that.
(2) drop index videourl
(3) drop index videourl; create index videourl (videourl).
(4) if you want to ensure uniqueness across a set of columns, define
a unique composite key, for instance: create unique index01
(videourl,userid);
Indexes/keys do not have to be unique unless they are primary or
defined as unique.
steve
--
+--------------- my people are the people of the dessert, ---------------+
| Steve Edberg http://pgfsun.ucdavis.edu/ |
| UC Davis Genome Center sbedberg@stripped |
| Bioinformatics programming/database/sysadmin (530)754-9127 |
+---------------- said t e lawrence, picking up his fork ----------------+