field types and descriptions in SQL Server

Source: Internet
Author: User
Tags date arithmetic operators numeric
Server data type
Description
Synonymous
Bit
1 digits, value 0 or 1
Int
Integer
4 bytes, value is -2^31~2^31-1
Smallint
2 bytes, value is -2^15~2^15-1
Tinyint
1 bytes, value is 0~255
Decimal (P,s)
numeric data, with a fixed precision of p, and a width of s
Numeric
Money
8 bytes, store currency type, value is -2^63~2^63-1
Small Money
4 bytes, store currency type, value is -214748.3648~+214748.3647 approximate numeric data type
Float (N)
n between 1~24, 4 bytes, 7-bit precision
N=1~7 for Real


n between 25~53, 8 bytes, 15-bit precision
=8~15 for float

Datetime
8 bytes, describing the date and time of day, and the accuracy of the value is 1/300 seconds.
smalldatetime
4 bytes, describing the date and time of day, with a precision of minutes
Cursor
Reference to a cursor
Timestamp
8 bytes, the only data stored in the database
uniqueidentifier
16 bytes, holding globally unique identities (GUIDs)
Char (N)
Fixed length of non-Unicode strings, 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. Maximum length of 231-1 characters


Nchar
Fixed-length Unicode string n=1~4000
National character (n),
National char (N)

Nvarchar
Fixed-length Unicode string n=1~4000
national character varying (n)

Ntext
Variable-length Unicode data with a maximum length of 230-1 characters
National text

Binary (N)
Fixed-length binary data, n between 1~8000, storage space is n+4 byte


Varbinary (N)
Variable-length binary data, n=1~8000
Binary varying (n)

Tmage
Variable-length binary data, size 0~231-1


Attention:
1 for numeric data types, Width (scale) is the number of digits stored after the decimal point, and precision (precision) is the number of digits that can be stored that contain a decimal point.
2 The storage width of money and small money is 4.
3 The timestamp column value is updated automatically when each row is updated, and the timestamp column cannot be part of the keyword or keyword.
4 The unique identity data type cannot use arithmetic operators (such as +,-etc.), and this data type can only use equality comparison operations. Unicode is the standard for consistent storage of data in all character sets. It uses up to two times the storage space of a non-Unicode data store.



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.