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
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  
Question by:npglobal
  • 2
  • 2
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 24392425
DBCC CHECKIDENT (yourtable, reseed, UrExpectedNextNumber-1)
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

Author Comment

ID: 24392498
     Is there no slution except truncating the table and then restting it.
LVL 31

Accepted Solution

RiteshShah earned 250 total points
ID: 24392575

Author Closing Comment

ID: 31581803
Thanks a lot

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

Suggested Solutions

Title # Comments Views Activity
Change variables in SQL table 6 93
How to use TOP 1 in a T-SQL sub-query? 14 46
Query 14 57
convert null in sql server 12 45
Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit If you want to manage em…
In an interesting question ( here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

791 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