title: What do you do when your primary key overflows?
body: <p>We have a table, with an <code>auto-increment int</code> primary key, whose max value is now at the limit for the T-SQL <code>int</code> type. When we try to re-seed the table (because there are large gaps in the keys, nowhere near enough rows as the max <code>int</code> value), it somehow keeps getting reset to the max <code>int</code> value.</p>
  
  <p>Obviously, this causes serious problems. The PK never should have gotten to this value and changing the data type would be a big task. Re-seeding should be sufficient, but it's not working!</p>
  
  <p>How could it keep getting reset?</p>
  
  <p>Edit: to clarify the situation, this query <code>SELECT MIN(CategoryID), MAX(CategoryID) FROM dbo.tblCategories</code> returns -2147483647, 2147483647... meaning that there are actual PK values at the min and max of the <code>int</code> type.</p>