Default common data types for SQL tables

Source: Internet
Author: User

Classification Field type Describe
Integer Bit Integer numbers of 0 or 1
Int Integer numbers from -2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647)
smallint Integer numbers from -2^15 (-32,768) to 2^15-1 (32,767)
tinyint Integer numbers from 0 to 255
Exact decimals Decimal (P,s) Precision and number of effective digits from -10^38 to 10^38-1 p-width s
Numeric (P,s) Synonyms for decimal
Approximate decimals Float Variable-precision numbers from -1.79E+308 to 1.79E+308
Real Variable-precision numbers from -3.04E+38 to 3.04E+38
Currency Money

Currency data from -2^63 ( -922,337,203,685,477.5808) to 2^63-1 (922,337,203,685,477.5807),

Minimum currency unit 10 per thousand, Width 4

SmallMoney

Currency data from -214,748.3648 to 214,748.3647,

Minimum currency unit 10 per thousand, Width 4

Date Time Datetime

Date and time data from January 1, 1753 to 9999 12th 31,

The minimum time unit is 3% seconds or 3.33 milliseconds

smalldatetime

Date and time data from January 1, 1900 to June 6, 2079,

Minimum time unit is minutes

Special data types Timestamp Timestamp, unique number of a database width
Cursor A reference to a cursor
uniqueidentifier Global Unique identifier GUID
Character data Char Fixed-length non-Unicode character data with a maximum length of 8000
varchar Variable length non-Unicode character data up to a maximum of 8000
Text Variable length non-Unicode character data with a maximum length of 2^31-1 (2G)
Unicode NChar Fixed-length Unicode character data with a maximum length of 8000
nvarchar Variable-length Unicode character data up to a maximum of 8000
ntext Variable length Unicode character data with a maximum length of 2^31-1 (2G)
Binary data Binary Fixed-length binary data with a maximum length of 8000
varbinary Variable length binary data with a maximum length of 8000
Image Variable-length binary data with a maximum length of 2^31-1 (2G)

Note

1) For numeric data types, the width (scale) refers to the number of digits that are stored after the decimal point, and the precision (precision) is the number of digits that can be stored that contains the decimal point.
2) The storage width of money and small money is 4.
3) The timestamp column value is automatically updated when each row is updated, and the timestamp column cannot be part of the keyword or keyword.

4) Additional user-defined data types

(NET pick)

Default common data types for SQL tables

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.