Upper limit for autoincrement primary key in SQL Server

前端 未结 5 1451
南方客
南方客 2020-12-24 07:10

What is the upper limit for an autoincrement primary key in SQL Server? What happens when an SQL Server autoincrement primary key reaches its upper limit?

5条回答
  •  旧巷少年郎
    2020-12-24 07:27

    I'll tell you what happens.... my data stopped inserting into that specific table. The database still works but I found data missing and inconsistent. With a little research, I found the error table, then ran a manual insert. The error is the same as above.

    Had to change the column to BIGINT. On a 26GB database on a somewhat slow server, took about 30 minutes. On the archive version of the database (150GB or so) it took quite a bit longer.

    Fortunately, not too many relationships for this table so the pain was pretty slight.

提交回复
热议问题