I found a lot of topics telling to use :
DBCC CHECKIDENT ('table', RESEED, 0)
But this is not supported by Azure SQL. Does somebody have any idea on how to do it easily ?
Thanks a lot !
Here, to reset the Identity column in SQL Server you can use DBCC CHECKIDENT method. Syntax : DBCC CHECKIDENT ('table_name', RESEED, new_value); Note : If we reset the existing records in the table and insert new records, then it will show an error.
Reset the auto increment fieldALTER TABLE `table` AUTO_INCREMENT = number; Replacing 'number' with the result of the previous command plus one and replacing table with the table name. If you deleted all the rows in the table, then you could run the alter table command and reset it to 0.
Auto-increment allows a unique number to be generated automatically when a new record is inserted into a table. Often this is the primary key field that we would like to be created automatically every time a new record is inserted.
DBCC CHECKIDENT is not supported for now in SQL Azure as you commented.
Check this MSDN forum post, there are some solutions proposals, maybe one of them can help you out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With