List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:February 16 2000 12:41pm
Subject:Re: UNIQUE INDEX on CHAR(255) field
View as plain text  
At 4:03 PM +1300 2000-02-16, James Tyson wrote:
>  > I'm not sure I understand you...are you wanting to do this?
>>
>>      CREATE TABLE snmp_oids (
>>          oid char(255) not null,
>>          ...,
>>          PRIMARY KEY (oid(255))
>>      )
>>
>>  Where you use the whole char field for the index?
>>
>>  If that's what you want, then sure - that's what you would get if you
>>  just said "PRIMARY KEY (oid)".
>>
>>  If that's not what you want, then can you please explain again what you
>>  want to do?  Maybe with some code that is explicit?
>
>Oh yeah (smacks head), except I already have a primary key field in that
>table, but this works:
>
>CREATE TABLE OID (
>	ID bigint(64) unsigned not null auto_increment,
>	OID char(255) not null,
>	Description char(255) not null,
>	Priority int(8) not null,
>	PRIMARY KEY (ID),
>	UNIQUE OID_OID (OID(255),
>	KEY OID_Priority (Priority(255))
>	);
>
>Seems to achieve what I wanted, which is the main thing, eh?
>I was just confused by the documentation saying that you couldn't create a
>unique index on a text field.
>
>Cheers.
>
>James Tyson ---
>Samizdat New Media Solutions


You don't appear to have any text fields, though.

-- 
Paul DuBois, paul@stripped
Thread
UNIQUE INDEX on CHAR(255) fieldJames Tyson16 Feb
  • Re: UNIQUE INDEX on CHAR(255) fieldsasha16 Feb
    • Re: UNIQUE INDEX on CHAR(255) fieldJames Tyson16 Feb
      • Re: UNIQUE INDEX on CHAR(255) fieldThimble Smith16 Feb
        • Re: UNIQUE INDEX on CHAR(255) fieldJames Tyson16 Feb
          • Re: UNIQUE INDEX on CHAR(255) fieldPaul DuBois16 Feb