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

來源: 雞毛蒜皮 2006-05-05 10:53:55 [] [博客] [舊帖] [給我悄悄話] 本文已被閱讀: 次 (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”