Maximum SQL Server Authentication Field Size

What is the maximum size of a SQL Server authentication field (int)?

I delete and insert record threads at once several times a day into several tables, and I'm curious what effect this will have on the auto-identification field.

I can run work every night or so and crop this data if necessary.

I would be grateful for your thoughts.

Thanks.

+6
source share
4 answers

INT will take you to 2,147,483,647.

A BIGINT will get you 9,223,372,036,854,775,807.

+15
source

2 ^ 31 - 1 (2,147,483,647) - upper int range

+5
source

The limit is related to the data type itself, and not to the fact of automatic increase.

If you are worried about the maximum size, you can run the sequence below zero and thus double the capacity, for example:

CREATE TABLE [MYTABLE]( [ID] [int] IDENTITY(-2147483648,1), (...) 
+1
source
  • bigint - Range: -2 ^ 63 (-9,223,372,036,854,775,808) to 2 ^ 63-1 (9,223,372,036,854,775,807) Storage: 8 bytes
  • int - Range: -2 ^ 31 (-2,147,483,648) to 2 ^ 31-1 (2 147 483 647) Storage: 4 bytes
  • smallint - Range -2 ^ 15 (-32,768) to 2 ^ 15-1 (32,767) Storage: 2 bytes li>
  • tinyint - Range 0 to 255 Storage: 1 byte
+1
source

Source: https://habr.com/ru/post/904315/


All Articles