Field Types and descriptions in SQL Server

Source: Internet
Author: User

Format description:

Data Type

Description

Same meaning

Bit

1 bit; Value: 0 or 1

Int

Integer

4 bytes; value range:-2 ^ 31 ~ 2 ^ 31-1

Smallint

2 bytes; value range:-2 ^ 15 ~ 2 ^ 15-1

Tinyint

1 byte; value range: 0 ~ 255

Decimal (P, S)

Numeric data with a fixed precision of P and a width of S

Numeric

Money

8 bytes, which stores the currency type; value range:-2 ^ 63 ~ 2 ^ 63-1

Small money

4 bytes, which stores the currency type. The value ranges from-214748.3648 ~ + 214748.3647 approximate numeric data types

Float (N)

N in 1 ~ Between 24, 4 bytes, 7-bit precision

N = 1 ~ 7 is real

N in 25 ~ Between 53, 8 bytes, 15-bit precision

= 8 ~ 15 is float

Datetime

8 bytes to describe the date and time of a day. The value is accurate to 1/300 seconds.

Smalldatetime

4 bytes, which describes the date and time of a day, precise to minutes

Cursor

References to a cursor

Timestamp

8 bytes, unique data stored in the database

Uniqueidentifier

16 bytes, stores the Globally Unique Identifier (guid)

Char (N)

The fixed length of a non-Unicode string, n = 1 ~ 8000

Character (N)

Varchar (N)

Variable Length, non-Unicode string n = 1 ~ 8000

Char varying (N)

Text

Variable-length non-Unicode data in the server code page. The maximum length is 23-1 Characters

Nchar

Unicode string of fixed length n = 1 ~ 4000

National Character (N ),

National char (N)

Nvarchar

Unicode string of fixed length n = 1 ~ 4000

National Character varying (N)

Ntext

Unicode data with a variable length. The maximum length is-1 characters.

National text

Binary (N)

Binary data of fixed length, where n ranges from 1 ~ The storage space is n + 4 bytes.

Varbinary (N)

Variable Length binary data, n = 1 ~ 8000

Binary varying (N)

Tmage

Variable-length binary data; Size: 0 ~ 231-1

Note:

1) For numeric data types, width (scale) refers to the number of digits stored after the decimal point, while precision refers to the number of digits that can be stored including 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. The timestamp Column cannot be a part of a keyword or keyword.

4) Arithmetic Operators (such as + and-) cannot be used to uniquely identify data types. Such data types can only use equal comparison operations. Unicode is the standard for consistent data storage for all character sets. It uses twice the storage space of Non-Unicode data storage.

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.