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
303 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now