Is it possible to reset the identity column in a compact database? I'm finding lots of answers regarding standard SQL Server, but no definitive answer regarding if it is possible using SQL CE.
Dropping and recreating the table is not ideal in my scenario!
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.
You can not update identity column. SQL Server does not allow to update the identity column unlike what you can do with other columns with an update statement.
You cannot remove an IDENTITY specification once set. If you need to keep the data, but remove the IDENTITY column, you will need to: Create a new column. Transfer the data from the existing IDENTITY column to the new column.
ALTER TABLE [MyTable] ALTER COLUMN [Id] IDENTITY (1,1)
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