Generate SQL to update primary key

后端 未结 4 1484
滥情空心
滥情空心 2020-12-15 06:56

I want to change a primary key and all table rows which reference to this value.

# table master
master_id|name
===============
foo|bar

# table detail
detail         


        
4条回答
  •  臣服心动
    2020-12-15 07:15

    I dont think you can update the Primary key. One possible work around is that you can remove the primary key constraint from the table column. Then update the column value.

    Updating the primary key can lead you to some serious problems. But if you still want to do it.

    Please refer this Thread.(kevchadders has given a solution.)

提交回复
热议问题