September 18th, 2000, 05:20 AM
how can i change the value of a primary key to a new value?
i've tried this using php, but it doesnt work:
Update MyTable set MyPrimaryKey='DEF' Where MyPrimaryKey='ABC'
*the table MyTable only contains one column, i.e. MyPrimaryKey
what did i do wrong here? thanks to any help.
September 19th, 2000, 06:19 PM
You didn't say what didn't work or what happened. One thing to watch for is ensuring that you *do* have a unique key. The update command, in general, affects more than one row.
September 20th, 2000, 01:51 AM
steve100: You didn't say what didn't work or what happened.
sorry steve100! ok here's what didnt work. i've ran the query using php, but the change was not reflected in my database, i.e. the MyPrimaryKey's value remains the same before and after the query is ran. hence my question, what did i do wrong here? is the update query's syntax is wrong?
fyi, i've double-checked my table design, it only contains one column, i.e. MyPrimaryKey. the column is indeed set as primary key, and is both unique and indexed. am i missing something here? can u help me? thank you for your reply steve100.
"Your god is one god..."
(Deuteronomy 6:4, Mark 12:29, Quran 2:163)