Har en tabell med en massa rader i en databas i SQL S2k. Nu skulle jag vilja slänga in en Identity kolumn också. Problemet är att om jag tömmer tabellen och matar in nytt data så kommer även identity att fortsätta att räkna de nya raderna där den slutade sist. Så istället för att räkna om på nytt från 1 så räknar den från tex. 800 där den slutade sist.
Finns det nått sätt att få den att räkna från början. Typ i princip bara räkna antalet rader?
The DELETE statement removes rows one at a time and records an entry in the transaction log for each deleted row. TRUNCATE TABLE removes the data by deallocating the data pages used to store the table's data, and only the page deallocations are recorded in the transaction log.
TRUNCATE TABLE removes all rows from a table, but the table structure and its columns, constraints, indexes and so on remain. The counter used by an identity for new rows is reset to the seed for the column. If you want to retain the identity counter, use DELETE instead.