SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 reset an AutoNumber field value
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ITpassenger
Starting Member

Oman
6 Posts

Posted - 08/09/2011 :  00:51:15  Show Profile  Reply with Quote

How to reset an AutoNumber field value in SQL server 2005 ??

i get the steps in Access
but what about SQL server DB??

tkizer
Almighty SQL Goddess

USA
37133 Posts

Posted - 08/09/2011 :  01:06:37  Show Profile  Visit tkizer's Homepage  Reply with Quote
By reset, do you mean change the starting number? If so, check out DBCC CHECKIDENT in Books Online. If that isn't what you want, well please be more specific. Perhaps you are thinking about removing gaps.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

ITpassenger
Starting Member

Oman
6 Posts

Posted - 08/09/2011 :  01:15:49  Show Profile  Reply with Quote
Hi tkizer

i mean like this steps but for SQL server
http://support.microsoft.com/kb/812718
Go to Top of Page

russell
Pyro-ma-ni-yak

USA
5072 Posts

Posted - 08/09/2011 :  10:52:51  Show Profile  Visit russell's Homepage  Reply with Quote
As Tara said, DBCC CHECKIDENT is what you want.

If you want to delete all the data and reset it, then TRUNCATE the table.
Go to Top of Page

ITpassenger
Starting Member

Oman
6 Posts

Posted - 08/10/2011 :  05:29:05  Show Profile  Reply with Quote
Thanks russell,
i used TRUNCATE and is worked
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.07 seconds. Powered By: Snitz Forums 2000