#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Malaysia
    Posts
    13
    Rep Power
    0
    hello

    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.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    ca, usa
    Posts
    10
    Rep Power
    0
    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.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Malaysia
    Posts
    13
    Rep Power
    0
    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.

    ------------------
    DVE

    "Your god is one god..."
    (Deuteronomy 6:4, Mark 12:29, Quran 2:163)

Similar Threads

  1. auto_increment primary key field
    By ez_d_ in forum MySQL Help
    Replies: 4
    Last Post: December 29th, 2003, 07:08 PM
  2. drop primary key -> error 2003
    By smeagl in forum MySQL Help
    Replies: 0
    Last Post: November 11th, 2003, 08:59 AM
  3. newbie with postgres
    By edwinx in forum PostgreSQL Help
    Replies: 5
    Last Post: October 9th, 2003, 06:21 PM
  4. Simple keyboard problem
    By BusterKirk in forum Visual Basic Programming
    Replies: 5
    Last Post: October 4th, 2003, 01:44 PM
  5. Foreign key linked to primary key-not updating
    By Reg010 in forum Visual Basic Programming
    Replies: 1
    Last Post: September 11th, 2003, 09:52 AM

IMN logo majestic logo threadwatch logo seochat tools logo