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
308 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
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 https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

730 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