Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CHANGE COLUMN unique 1

Status
Not open for further replies.

soundmind

Technical User
Jun 30, 2003
16
US
Hi, I'm trying to change a column type to unique.

I tried the following but got some interesting error msgs.
Please help!

Here's what I tried:

ALTER TABLE number CHANGE COLUMN date unique
ALTER TABLE number CHANGE ADD unique(date)
ALTER TABLE number CHANGE date ADD unique (date)

Thanks!
 
"Unique" is not a property of a column, but rather a property of an index on a column. So you don't want to change the column but rather add a unique index on that column.

Look for the text "ADD UNIQUE" on the MySQL online manual page which covers ALTER TABLE,

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top