Groups | Blog | Home
all groups > sql server msde > august 2004 >

sql server msde : Resetting rows count


Nikolay Petrov
8/16/2004 4:33:44 PM
I have a table in Database where I have added and removed rows, during the
period of developing applications. Now I have removed all row, but when new
are added, their IDs don't start from 1.
Is there a way to reset some counter or something?

Andrea Montanari
8/16/2004 5:06:50 PM
hi Nikolay,
"Nikolay Petrov" <johntup2@mail.bg> ha scritto nel messaggio
news:%23AvGpW5gEHA.1184@TK2MSFTNGP12.phx.gbl...
[quoted text, click to view]

you are probably referring to a table colum's property known as IDENTITY...
in order to reset it's internal value, you can have a look at the DBCC
CHECKIDENT
(..)http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref
/ts_dbcc_5lv8.asp action...
if you want to delete all rows from a user table and reset the IDENTITY
property on the same time, you can issue a TRUNCATE TABLE statement instead
of DELETE FROM...
--
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtm http://italy.mvps.org
DbaMgr2k ver 0.8.0 - DbaMgr ver 0.54.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
--------- remove DMO to reply
AddThis Social Bookmark Button