The BIGINT
data type is an integer value from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
BIGINT
is SQL Server's largest integer data type. It uses 8 bytes of storage.
BIGINT
should be used when values can exceed the range of INT.
A table with a BIGINT
column.
CREATE TABLE DemoTable
(
Id INT IDENTITY,
Company VARCHAR(100),
NetWorth BIGINT
);
GO
INSERT INTO DemoTable VALUES ('Apple', 2252300000000);
INSERT INTO DemoTable VALUES ('Microsoft', 1966600000000);
INSERT INTO DemoTable VALUES ('Saudi Arabian Oil Company', 1897200000000);
INSERT INTO DemoTable VALUES ('Amazon', 1711800000000);
INSERT INTO DemoTable VALUES ('Alphabet', NULL);
GO
SELECT * FROM DemoTable;
GO
DROP TABLE DemoTable;
GO
Id | Company | NetWorth |
---|---|---|
1 | Apple | 2252300000000 |
2 | Microsoft | 1966600000000 |
3 | Saudi Arabian Oil Company | 1897200000000 |
4 | Amazon | 1711800000000 |
5 | Alphabet | 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 |