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
 SQL Server Development (2000)
 Reset Autonumber to 1

Author  Topic 

BaldEagle
Starting Member

23 Posts

Posted - 2002-04-22 : 15:39:52
I got a table which has a field which automatically increment when a i add in a field. How can i reset the number back to 1 coz now it is ard 1000 already. Can i set it back to 1?

VyasKN
SQL Server MVP & SQLTeam MVY

313 Posts

Posted - 2002-04-22 : 16:28:42
If you want to get rid of data as well, thenm try TRUNCATE TABLE. For more info: http://vyaskn.tripod.com/administration_faq.htm#q2

--
HTH,
Vyas
Check out my SQL Server site @
http://vyaskn.tripod.com
Go to Top of Page

monkeybite
Posting Yak Master

152 Posts

Posted - 2002-04-22 : 16:42:19
You can use the command DBCC CHECKIDENT to reset the identity (autonumber) field in a table.

Look up the syntax of DBCC CHECKIDENT in the SQL Books Online, or view the documentation here:

[url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_dbcc_5lv8.asp[/url]

-- monkey

Go to Top of Page

Southpaw
Starting Member

6 Posts

Posted - 2002-04-23 : 10:05:33
DBCC CHECKIDENT('TABLE NAME', RESEED, 0)

-- Southpaw
Go to Top of Page
   

- Advertisement -