刪除資料後,如何重新流水號,剛好碰到這問題,記錄一下語法,以防將來忘記了。

原始資料如下
undefined

DELETE FROM table_account 
WHERE tb_id = 'idone'
AND tb_item = 1

DECLARE @item INT
SET @item = 0
UPDATE table_account SET
@item = @item + 1
,[tb_item] = @item
WHERE tb_id = 'idone'

重新編號後
undefined

 


arrow
arrow

    Roger 發表在 痞客邦 留言(0) 人氣()