data troubles

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
Obadiah
Forum Regular
Posts: 580
Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:

data troubles

Post by Obadiah »

i made a mistake when i was creating a one to one database relationship type....in the customer table "user_name" is the primary key....now in the merchant table...i made user_name being unique when in actuality it shouldent be...but now i cant fugure out how to change it back to just being a regular varchar....i tried this in my xampp...

Code: Select all

ALTER TABLE `merchant` DROP INDEX `user_name`, ADD `user_name` (`user_name`)
but it gives me this as an error
Error
SQL query:

ALTER TABLE `merchant` DROP INDEX `user_name` ,
ADD `user_name` (

`user_name`
)

MySQL said:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(`user_name`)' at line 1
please help :(
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You're supposed to have a column definition statement after the field name.
User avatar
Obadiah
Forum Regular
Posts: 580
Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:

Post by Obadiah »

what do you mean?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You've asked it to drop an index.. and add... (you didn't specify what you wanted added.)
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Post by califdon »

Code: Select all

check the manual that corresponds to your MySQL server version for the right syntax to use
They really mean that. Check out http://mysql.org/doc/refman/5.0/en/alter-table.html
Post Reply