New features of SQL Server 2000: bigint data types

Source: Internet
Author: User
Tags integer new features range

Although int is still the primary integer data type in SQL Server 2000, SQL Server 2000 is a new addition to the integer data type bigint, which applies to situations where integers exceed the int data range.

The int data type represents a range of values from -2^31 to 2^31-1, that is, you can use INT data types to express integers between 2,147,483,648 and 2,147,483,647 (that is, about 2 billion). An int consumes four bytes of storage space.

The bigint can accurately represent integers from -2^63 to 2^63-1 (that is, from 9,223,372,036,854,775,808 to 9,223,372,036,854,775,807), which occupies eight bytes of storage space.

When you use bigint, you need to pay attention to the following points:

In a data type precedence table, the bigint data type is positioned above the int, under SmallMoney.
SQL Server cannot automatically convert int data to bigint type.
If a function's argument expression is a bigint type, the function can only return data of type bigint. Functions that use the bigint data type are AVG, CEILING, FLOOR, MAX, MIN, round, sum, and so on.
You can use the bigint data type in all syntactic locations where integer data is specified: Alter PROCEDURE, ALTER TABLE, create PROCEDURE, create TABLE, and declare variables.
You can get the bigint column information in the SQL Server directory component (catalog components)

You may wonder why anyone might need to use the bigint data type. In fact, this question is not difficult to answer, for example, when your database needs to do large data operations (such as the credit card companies often encounter this situation), you need to use the bigint data type.



Related Article

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.