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
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]      ???

Link to comment
Share on other sites

[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
Link to comment
Share on other sites

[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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.