Problem creating primary key on blob column

2001-11-26 Thread TOMASSONI Dominique

Hello the list,

I try to create a table with a TEXT primary key, and this error message
appear :

ERROR 1170 : BLOB column 'MY_COLUMN' used in key specification without a key
length.

What is the syntax to settle a key length ?

Here is my sql code to create my table:
-- 
--   Table : MY_TABLE
-- 
create table MY_TABLE
(
MY_COLUMN_1TEXT   not null,
MY_COLUMN_2VARCHAR(2)   not null,
MY_COLUMN_3TEXT   not null,
constraint PK_TRADUCTION primary key (MY_COLUMN_1, MY_COLUMN_2)
)
;


-
Dominique TOMASSONI - [EMAIL PROTECTED]
SunGard Investment Management Systems

173, Bureaux de la Colline
Bâtiment E
92213 Saint-Cloud
Tél : +33 1 49 11 31 23
Fax : +33 1 49 11 30 65

-


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Problem creating primary key on blob column

2001-11-26 Thread Giuseppe Maxia


ERROR 1170 : BLOB column 'MY COLUMN' used in key specification without a key
length. What is the syntax to settle a key length ? 


ALTER TABLE  your_table add key blob_field (blob_field(50));

Or, you can create a table like this one:

CREATE TABLE `your_table` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(2) NOT NULL default '',
  `blob_field` TEXT,
  PRIMARY KEY  (`id`),
  KEY `blob_field` (`blob_field`(20)) # indexed on the first 20 characters of the field
) TYPE=MyISAM


BLOB and TEXT field can be indexed on a fixed amount of data only. Therefore
you  must specify the length of the index.

Giuseppe




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php