Wednesday, 25 May 2016

How to reset the sequence number of a table in Sql Server

The sequence numbers are used as primary keys in most of the table. Main purpose of this is to generate a unique sequential number. During the development, we would face many situations where we need to reset or reseed the sequence number. The syntax varies in different Database software like DB2, Oracle, Sql Server, MySQL and so on.

We are going to see how to reset this.

use 'Database Name'
dbcc checkident('Schema.Table',RESEED,0);

The above command will reset it to 0. The sequence will start from 1.

No comments:

Post a Comment