Although int is still the most important Integer Data Type in SQL Server 2000, SQL Server 2000 adds the bigint data type, which is used when the integer exceeds the int data range.
The value range of the int data type ranges from-2 ^ 31 to 2 ^ 31-1. That is to say, you can use the int data type to express-2,147,483,648 to 2,147,483,647 (about -2 billion) an integer. An int type occupies four bytes of storage space.
Bigint can accurately represent an integer from-2 ^ 63 to 2 ^ 63-1 (from-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807). It occupies eight bytes of storage space.
When using bigint, pay attention to the following points:
In the data type priority table, the bigint data type is located under int and smallmoney.
SQL Server cannot automatically convert int type data to bigint type data.
If the function parameter expression is of the bigint type, the function can only return data of the bigint type. Bigint data type functions include AVG, ceiling, floor, Max, Min, round, and sum.
Bigint data types can be used in all the syntax positions of the specified integer data: Alter procedure, alter table, create procedure, create table, and declare variables.
You can obtain the information in the bigint column from the SQL Server Directory Component (catalog components ).
You may wonder why anyone may need to use the bigint data type. In fact, this question is not difficult to answer. For example, when your database needs big data computation (for example, this is often the case for credit card companies), you need to use the bigint data type.