Skip Navigation Links
Home
Functions
Tips & Tricks
SQL Server 2005
SQL Server 2008
SQL Server 2012
FAQ
Forums
Practice Test
Bookstore
Tip of the Day : How to Restart / Reset / Reseed an Identity Column From 1
Welcome to SQL Server Helper!!!

This site is intended for those who are beginning to use SQL Server as part of their day-to-day activities.  You will find in this site a collection of useful functions, triggers, stored procedures and tips and tricks related to SQL Server.

Should you have any comments or questions regarding this site or if you want to ask SQL Server-related questions, e-mail us here.

We hope we are able to help and we are glad to help!!!

 
SQL Server Tip of the Day - May 22, 2015
How to Restart / Reset / Reseed an Identity Column From 1


To restart or reset the values of the IDENTITY column of a table, the DBCC CHECKIDENT command can be used.  The DBCC CHECKIDENT command checks the current identity value for the specified table and, if it is needed, changes the identity value.  The DBCC CHECKIDENT can also be used to manually set a new current identity value for the identity column.

The syntax of the DBCC CHECKIDENT command is as follows:


DBCC CHECKIDENT ( <table_name> [ , { NORESEED | { RESEED [, <new_reseed_value> ] } } ] )
[ WITH NO_INFOMSGS ]

The <table_name> parameter is the name of the table for which to check the current identity value and it must contain an identity column.  The NORESEED clause specifies that the current identity value should not be changed.  The RESEED clause specifies that the current identity value should be changed.  The <new_reseed_value> is the new value to be used as the current value of the identity column.  Lastly, the WITH NO_INFOMSGS clause suppresses all informational messages.

To set the IDENTITY column of a table to start from 1, the following statement can be issued:

DBCC CHECKIDENT ( '[dbo].[Customers]', RESEED, 1 )

This statement should be used only if no rows have been inserted into the table since the table was created, or if all rows have been removed by using the TRUNCATE TABLE statement.  If the table already has rows before and the rows were removed using the DELETE statement, the following statement should be used instead:

DBCC CHECKIDENT ( '[dbo].[Customers]', RESEED, 0 )
 
SQL Server 2012
What's New in SQL Server 2012
SQL Server 2012 Articles
 
SQL Server 2008
What's New in SQL Server 2008

A collection of articles related to what's new with SQL Server 2008:

SQL Server 2008 Articles

A collection of articles related to SQL Server 2008:

 
User-Defined Functions
Date Functions

A collection of useful user-defined functions that deal with dates.

String Functions

A collection of useful user-defined functions that deal with strings (varchar/char/nvarchar/nchar).

Tree Functions

A collection of useful user-defined functions that deal with tree or hierarchical design structures.

Table-Valued Functions
A collection of useful table-valued user-defined functions that can be used to join with other tables.
SQL Server Built-in Functions
A reference to all built-in functions available within SQL Server grouped into categories.
 
Tips and Tricks

A collection of useful SQL Server-related tips and tricks:

SQL Server Error Messages

A list of SQL Server error messages and for certain error messages, discusses ways on how to solve the error or work around them:

 
Frequently Asked Questions
SQL Server

A collection of frequently asked questions about SQL Server grouped by categories:

SQL Server 2005

A collection of frequently asked questions about SQL Server 2005 grouped by categories: