The SMALLINT
data type is an integer value from -32,768 to 32,767.
SMALLINT
uses 2 bytes of storage.
A table with a SMALLINT
column.
CREATE TABLE DemoTable
(
Id INT IDENTITY,
BuildingName VARCHAR(100),
Age SMALLINT
);
GO
INSERT INTO DemoTable VALUES ('Ancestral Puebloan dwellings', 173);
INSERT INTO DemoTable VALUES ('Deane Winthrop House', 346);
INSERT INTO DemoTable VALUES ('White Horse Tavern', 369);
INSERT INTO DemoTable VALUES ('Old Powder House', 274);
INSERT INTO DemoTable VALUES ('Chaco Canyon', NULL);
GO
SELECT * FROM DemoTable;
GO
DROP TABLE DemoTable;
GO
Id | BuildingName | Age |
---|---|---|
1 | Ancestral Puebloan dwellings | 173 |
2 | Deane Winthrop House | 346 |
3 | White Horse Tavern | 369 |
4 | Old Powder House | 274 |
5 | Chaco Canyon | NULL |
CREATE TABLE DemoTable
(
MyBigInt BIGINT,
MyInt INT,
MySmallInt SMALLINT,
MyTinyInt TINYINT
);
GO
INSERT INTO DemoTable VALUES (9223372036854775807, 2147483647, 32767, 255);
GO
SELECT * FROM DemoTable;
GO
DROP TABLE DemoTable;
GO
MyBigInt | MyInt | MySmallInt | MyTinyInt |
---|---|---|---|
9223372036854775807 | 2147483647 | 32767 | 255 |