Jump to content

Need help for Unique key


sivanath.nagendran

Recommended Posts

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 help

By
Sivanath.N
Link to comment
https://forums.phpfreaks.com/topic/29727-need-help-for-unique-key/
Share on other sites


  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 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 help

By
Sivanath.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 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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.