SMALLINT (TSQL Datatype)
Is a 2-bytes signed integer.
Syntax
SMALLINT
Range
-32,768 to 32,767
Literal Smallint
There is no syntax for writing a literal
smallint
.
You just use a literal int
, and it will be converted to smallint
.
DECLARE @a SMALLINT;
SET @a = 123; -- 123 is a literal 'int'
Examples
DECLARE @a SMALLINT = 123;
PRINT @a * 100000; -- result is 'int', because 'smallint' * 'int' --> 'int'
The result is:
12300000