-1

I am using SQL Server 2012. When I make an identity column which starts from 1 and increases by 1 on each insert but suddenly me identity increases from a huge margin

enter image description here

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Asad Jivani
  • 535
  • 1
  • 5
  • 15
  • 1
    This can only happen, if you have deleted many rows recently. – Rahul Nov 29 '14 at 21:21
  • yup i deleted many rows. . but whether is there any solution of it? – Asad Jivani Nov 29 '14 at 21:24
  • @Asad Jivani - http://www.howtogeek.com/howto/database/reset-identity-column-value-in-sql-server/ – iCobot Nov 29 '14 at 21:24
  • @iCobot well I know how to reseed an identity but i am asking the solution of this error ?Is it a bug? – Asad Jivani Nov 29 '14 at 21:26
  • If you've deleted many rows, it's logical that the missing identity values are those that belonged to the deleted rows. The point is, what is the problem you're searching a solution for? – Alejandro Nov 29 '14 at 21:35

1 Answers1

0

This can only happen, if you have deleted many rows recently and so your IDENTITY column will start from the last seed value. Yes, you can reseed the identity column using DBCC command utility like below but that's unnecessary. Let, the identity column increase in it's normal way and you shouldn't be much worried about that.

DBCC CHECKIDENT ('table_name', RESEED, 25);
Rahul
  • 76,197
  • 13
  • 71
  • 125
  • Ok..but is there any Solution of this error?except to reseed an identity column – Asad Jivani Nov 29 '14 at 21:30
  • NO, reseeding is the way but that's really not needed. Moreover, jump on identity value shouldn't bother you much ... let it grow in it's usual space. – Rahul Nov 29 '14 at 21:31