How to reset identity seed in Sql Azure

前端 未结 3 1251
遇见更好的自我
遇见更好的自我 2020-12-07 00:46

I have tried the following in order to reset my Identity Seed of a column:

DBCC CHECKIDENT (\'dbo.Stuff\', RESEED, 0)

This does not work in

3条回答
  •  囚心锁ツ
    2020-12-07 01:17

    As you have seen, DBCC CHECKIDENT is not currently supported in Windows Azure SQL Database. The most complete way to reseed the identity would be to create a new table with the same structure, and set the identity to the Reseed value IDENTITY(reseedval,1), load existing records from the original table using SET IDENTITY_INSERT tablename ON, then drop the old table, and rename the new one. Reset permissions, reset constraints, etc.

提交回复
热议问题