Bigint Data Type

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.