Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 question about Delete and coulmn ID

Author  Topic 

hasanali00
Posting Yak Master

207 Posts

Posted - 2004-12-13 : 04:33:06
I have a table which includes one ID column. This column is set to Identity Increment by 1.

I run the following Delete command to delete all the content of this table.

"Delete from Table1". This deletes everything, but next time I add new rows to this table, the ID starts from the previous number, instead of starting from 1.

So if I had 10 rows, then I deleted these 10 rows, the next row I add would start from 11.

My question is: How can I ensure that the next time I add rows to this table, The ID starts from 1, instead of carrying on from the deleted numbers.?

regadrs

nr
SQLTeam MVY

12543 Posts

Posted - 2004-12-13 : 04:34:43
either do a truncate or use dbcc checkident to reseed the identity.


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -