Solved

MSSQL Wish to to reset the column with correct sequence post insert/delete data in an auto increment (auto id ) column

Posted on 2009-05-14
5
306 Views
Last Modified: 2012-05-07
MSSQL Wish to to reset the column with correct sequence post insert/delete data in an auto increment (auto id ) column  
0
Comment
Question by:npglobal
  • 2
  • 2
5 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 24392425
DBCC CHECKIDENT (yourtable, reseed, UrExpectedNextNumber-1)
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 24392429
if you want to restart the number from 1, you  just need to TRUNCATE the table
0
 

Author Comment

by:npglobal
ID: 24392498
Thanks,
     Is there no slution except truncating the table and then restting it.
0
 
LVL 31

Accepted Solution

by:
RiteshShah earned 250 total points
ID: 24392575
0
 

Author Closing Comment

by:npglobal
ID: 31581803
Thanks a lot
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question