12

I Use a Sql Server Compact Edition Database File For Store the Data in My Windows Application Software.

In this database I have a table with an identity field.

When I insert a record into the Table, the identity code increments automatically. But when I delete all the records from the table, and insert some records again, the identity field doesn't start at 1.

How can I reset this value to 1?

Hugo Dozois
  • 8,147
  • 12
  • 54
  • 58
Hossein Moradinia
  • 6,116
  • 14
  • 59
  • 85

1 Answers1

21

DBCC does not exist in CE, but you can use this instead:

ALTER TABLE t1 ALTER COLUMN id IDENTITY (1,1)
Danny Beckett
  • 20,529
  • 24
  • 107
  • 134
cdonner
  • 37,019
  • 22
  • 105
  • 153