Int The main key is to exceed the int interval

Just wondering what actually happens after you have exceeded 2147483647 records?

+6
sql-server sql-server-2008 database-design
source share
3 answers

try

CREATE TABLE #tester ( testerid INT IDENTITY(1, 1) not null CONSTRAINT pk_tester PRIMARY KEY CLUSTERED) DBCC checkident(#tester, reseed, 2147483647) INSERT #tester DEFAULT VALUES INSERT #tester DEFAULT VALUES 

Msg 8115, Level 16, State 1, Line 1
Arithmetic overflow error converting IDENTITY to int data type.

See also What to do when your Identity Coles Maxes Out column for a quick fix.

+12
source share

Most people forget that there is a negative side to int, which is more than a positive side. If you think you can outrun positive int values, just enter your identity at the negative end of the range -2,147,483,648. Or really play with the new senior DBA with 2147,483,647 and step -1.

+1
source share

If you think you are most likely to use a wide range data type. For example, NUMERIC or BIGINT.

+1
source share

All Articles