sivanath.nagendran Posted December 6, 2006 Share Posted December 6, 2006 Hi I had designed one table srt_users also I declared UserId as a Primary key. Now I need to know how to set Email-id as a UNIQUE KEY ??? in MySQl 4.1. I m using PHP5 + MySQL 4.1. i ALSO TRYING declareEmail as a Unique key but it shows the following error in MySQL command prompt [color=red][b]" ERROR 1170 (42000): BLOB/TEXT column 'Email' used in key specification without a key length "[/b][/color]Thanks for helpBySivanath.N Quote Link to comment Share on other sites More sharing options...
btherl Posted December 7, 2006 Share Posted December 7, 2006 What command did you use? Quote Link to comment Share on other sites More sharing options...
sivanath.nagendran Posted December 7, 2006 Author Share Posted December 7, 2006 I used these commands for set Unique key to a field. I need to set Email as a Unique key. I set Email varchar(30), These way I trying to set Unique key. The commands are 1. [b]UNIQUE KEY Email (Email);[/b] ??? 2. [b]UNIQUE KEY 'Email' ('Email');[/b] ??? 3. [b]UNIQUE Email (Email);[/b] ??? Quote Link to comment Share on other sites More sharing options...
fenway Posted December 9, 2006 Share Posted December 9, 2006 Well, that's not what the error says -- which is that you can't have a unique index on a text/blob field -- i see a varchar in your last post. Quote Link to comment Share on other sites More sharing options...
sivanath.nagendran Posted December 11, 2006 Author Share Posted December 11, 2006 Pls can anyone help me how to assign Unique key to any field?advance thanks to your's helpBySivanath.N Quote Link to comment Share on other sites More sharing options...
fenway Posted December 15, 2006 Share Posted December 15, 2006 So which one is it? VARCHAR or TEXT/BLOB? Quote Link to comment Share on other sites More sharing options...
shvijay Posted December 18, 2006 Share Posted December 18, 2006 [quote author=sivanath.nagendran link=topic=117641.msg482942#msg482942 date=1165874433]Pls can anyone help me how to assign Unique key to any field?advance thanks to your's helpBySivanath.N[/quote] Let me know what type of datatype used for that field which you want to make unique. If that is varchar you must defined the length Quote Link to comment Share on other sites More sharing options...
sivanath.nagendran Posted December 18, 2006 Author Share Posted December 18, 2006 I am using MySQL database. Quote Link to comment Share on other sites More sharing options...
artacus Posted December 18, 2006 Share Posted December 18, 2006 *slaps head against monitor* Quote Link to comment Share on other sites More sharing options...
fenway Posted December 19, 2006 Share Posted December 19, 2006 [quote author=artacus link=topic=117641.msg487774#msg487774 date=1166485595]*slaps head against monitor*[/quote]Now, now, that's what trouts are for... (I hope someone gets that reference)...But I digress... we need to know what column type you have chosen for this field. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.