[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [PHPwestoz] [OT] MySQL UNIQUE INDEX



Heh. My first post is giving info - go figure :)

Try:

CREATE TABLE library (
 ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
 Filename TEXT NOT NULL,
 Artist TEXT NULL,
 Title TEXT NULL,
 Album TEXT NULL,
 FID TEXT(40) NOT NULL,
 PRIMARY KEY ID (ID),
 INDEX UID (FID(40))
) TYPE = MyISAM COMMENT ='';

The manual reference you want is
http://dev.mysql.com/doc/mysql/en/indexes.html

:) - took me longer to find the reference than answer the question.

Cheers

-----Original Message-----
From: phpwestoz-admin@lists.linux.org.au
[mailto:phpwestoz-admin@lists.linux.org.au] On Behalf Of Timothy White
Sent: Monday, 21 February 2005 11:42 AM
To: phpwestoz@lists.linux.org.au
Subject: [PHPwestoz] [OT] MySQL UNIQUE INDEX

I know this isn't PHP but hopefully one of you guys will know the answer

(and it is for a PHP project)
I am trying to create a table that has a primary key and a unique key 
based on different columns.
The query is:
CREATE TABLE library (
 ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
 Filename TEXT NOT NULL,
 Artist TEXT NULL,
 Title TEXT NULL,
 Album TEXT NULL,
 FID TEXT(40) NOT NULL,
 PRIMARY KEY ID (ID),
 INDEX UID (FID)
) TYPE = MyISAM COMMENT ='';
And the error is:
ERROR 1170 (42000): BLOB/TEXT column 'FID' used in key specification 
without a key length
I can't find anything in the manual that tells me how to get around
this.

Thanks

Tim

-- 
Tim White - Use the Fox, Luke!
PGP/GPG id: 602E944D, Pub Key Serv: subkeys.pgp.net
Fingerprint: 04C2 9682 B7B2 3006 009D  A9F3 067E EDCD 602E 944D
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me
spread!
--


_______________________________________________
PHPwestoz mailing list
PHPwestoz@lists.linux.org.au
http://lists.linux.org.au/listinfo/phpwestoz