What is the max size of SQL Server identity field (int)?
I am deleting and inserting hundereds of records at a time a few times a day in a few tables and I'm curious what effect this will have regarding the auto-identity field.
I can run a job every night or so and truncate this data, if needed.
I'd appreciate your thoughts.
Thank you.
An INT will take you up to 2,147,483,647.
A BIGINT will get you 9,223,372,036,854,775,807.
2^31 - 1 (2,147,483,647) is the upper range of an int
The limit is related to the datatype itself, not with the fact of being auto increment.
If you are concerned about the maximum size, you can start the sequence below zero, and thus double the capacity, like this:
CREATE TABLE [MYTABLE](
[ID] [int] IDENTITY(-2147483648,1),
(...)