2009年3月15日 星期日

如何修改MSSQL Table的identity欄位的值?

由於備份回覆的關係需要調整資料表的identity欄位,
參考網路上的資訊得到的方法如下:


select * from T_TRansaction_for_wap
where create_datetime>'2009/03/13' and id<5550000

查詢資料表的identity值
dbcc checkident(T_TRansaction_for_wap,noreseed)

設定資料表的identity的新值
dbcc checkident(T_TX4WAP_0228,reseed,5500000)

設定資料表的identity的新值
dbcc checkident(T_TRansaction_for_wap,reseed,5550000)


reference:
http://diary.tw/tim/tag/SQL%20Server