INT (TSQL Datatype)

Is a 4-bytes signed integer.

Syntax

INT

Range

-2,147,483,648 to 2,147,483,647

Remarks

The datatype int is the main integer type used in RSQL. You can use it whenever you need to work with integer numbers.

If a table has columns defined as int, they don’t use more storage than tinyint or smallint when written to disk, because the data is compressed.

Literal Int

Any integer number in the range of int is parsed as int.

If an integer literal exceeds the range of int, it is parsed as numeric and not as bigint !

1234              -- is a literal 'int'
10000000000       -- is a literal 'numeric'

Examples

DECLARE @a INT = 12345;
DECLARE @b INT = 647;

PRINT @a + @b + 5;   -- 5 is a literal 'int'
PRINT @a * @b;

The result is:

12997
7987215