SQL Server data types

Source: Internet
Author: User

SQL Server data types

Transact-SQL ———— database programming language

One or two binary data binary data is stored in 16 binary form.

Format: 1, binary (n) ———— a fixed-length n-byte binary data, n means that the length of the data is 1~8000, the input data must be in the data before the ox as a binary identity.

2, varbinary (n) ———— custom n-byte variable-length binary data

Ox24 ———— Where: Ox is a hexadecimal type, 24 is hexadecimal data

Character data char (n) ———— character data type with a fixed length of n (1-8000), n represents the occupied storage space

Nchar (n) ———— length 1-4000, with N for Unicode standard character set, infrequently used

Three, String type

varchar (n) ———— a string type with a maximum length of n (1-8000) for a variable length. Save a few characters, such as name, login, password, etc., but no item can be longer than 8KB

Nvarchar (N)

Nvarchar (max) ———— Custom size, can change size does not contain string four, datetime type: Fixed length of data type

Time (N) ———— a 24-hour system, with only a few seconds, the greater the value in parentheses, the higher the precision of the second.

DateTime (N) ———— 24-hour datetime

DateTime ———— 1753-1-1 00:00:00 to A.D. 9999-12-31 23:59:59 smalldatetime

Datetimeofset ———— Date and time type with time zone

Five, shaping data types

bigint ———— (8B) ———— data per bigint type is 8 bytes (large integer)

int ———— (4B) ———— data for each int type is stored in 4 bytes, where 1 bits represent the sign of the integer value, and the other 31 bits represent the integer value length and size

smallint ———— (2B) ———— each smallint type of data is stored in 2 bytes, where 1 bits represent the sign of the integer value, and the other 15 bits represent the value length and size

tinyint ———— (1B)

Six, floating-point type

Real accurate to 7th decimal place, accounting for 4 bytes

Float ———— small precision, up to 15 decimal, accounting for 8 bytes

Decimal (p,s) ———— precision, accurate to four digits after the decimal point (p is the total number of digits is precision, S is the number of decimal places)

does not contain double

Boolean type (logical type)

Bit ———— byte type, only one byte can be placed, the value is 0 or 1, if the input other value will default to 1, cannot be defined as null.

does not contain bool

Viii. type of currency

Money ———— The type of stored number, which is a decimal value with four decimal places, 8 bytes, preceded by a currency symbol to differentiate the country, otherwise the default ¥

SmallMoney ———— Storage Currency range is small

Ix. type of text

The text ———— is used to store large text data of variable length, which can store 2GB

X. Image data Type

Image ———— in the database, to save the picture, try to save the picture path, do not store the picture directly

Xi. data types that are not commonly used

Geometry ———— geometry Geography ———— Map

12. Storage hierarchy (Relationship between table and table)

Herarchayid

13. XML:

A programming language for special writing rules that is designed to hold fixed data; in vs2012, the solution Manager has XML in config, configuration ———— store Some of the config information, parameters, etc.

SQL Server data types

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.