primary key 不能有重复的值吧?多年不玩,有点忘了。

来源: 鸡毛蒜皮 2006-05-05 10:53:55 [] [博客] [旧帖] [给我悄悄话] 本文已被阅读: 0 次 (628 bytes)
I may try this;
For the safety of the data, copy the table data into a EXCEL worksheet.
Insert a colume by the Order_ID (colume B), insert a row under the colume label row. In the first cell (B2)of the new colume under the colume label, type: max(first cell:last cell of the ORDER_ID colume, eg. A3:A10000).
In cell B3, type: =IF(B3=0,MAX(C$2:C2)+1,B3).
Copy the cell B3 and paste to B4:B10000.
All the Order_id that was 0 will become one greater than the maximum id before it.
After check the result, delete the old ir colume, delete the row under the label row and replace the old data table in the database.
请您先登陆,再发跟帖!

发现Adblock插件

如要继续浏览
请支持本站 请务必在本站关闭/移除任何Adblock

关闭Adblock后 请点击

请参考如何关闭Adblock/Adblock plus

安装Adblock plus用户请点击浏览器图标
选择“Disable on www.wenxuecity.com”

安装Adblock用户请点击图标
选择“don't run on pages on this domain”