title: Auto-increment counter in SQL Server database
body: <p>I am new to SQL Server, I have used MySQL (basic development). Now I wanted to create a table in my SQL Server which does auto-increment/-decrement depends up on addition and deletion of rows.</p>
  
  <p>And to create a table I found this one. example and I create my database but it is not working as that good. </p>
  
  <pre><code>CREATE TABLE Persons
  (
     ID int IDENTITY(1,1) PRIMARY KEY,
     LastName varchar(255) NOT NULL,
     FirstName varchar(255),
     Address varchar(255),
     City varchar(255)
  )
  </code></pre>
  
  <p>When I delete any rows still my ID should be decrement from <code>2-1 or 6-5 or 7-6</code> And Some time it automatically Increment from <code>7-9 or 6-9</code>. And It does not work perfectly.</p>
  
  <p>So can any one tell me how solve this problem I was trying nearly for 24hrs upto now and end up with no results.</p>
  
  <p>Please help how to solve this.</p>