Data type collation commonly used in SQL Server

Source: Internet
Author: User


when the contents of the input table are close to the same length. when the content size of the input table is variable.

Data type

Type

Description

Span style= "Font-size:12px;font-family:verdana;color:rgb (237,28,36);" >bit

int

bit data type is an integer whose value can be only 0, 1, or null. This data type is used to store data with only two possible values, such as Yes or no, True or FA LSE, on, or off

Span style= "Font-size:12px;font-family:verdana;color:rgb (237,28,36);" >int

int

int data type can store integers from 231 (-2147483648) to 231 (2147483647). Almost all numeric data stored in a database can be used with this data type. This type of data occupies 4 bytes in the database

Span style= "Font-size:12px;font-family:verdana;color:rgb (237,28,36);" >smallint

int

smallint data type can store integers from 215 (-32768) to 215 (32767). This data type is useful for storing numeric data that is often scoped to a specific range. This data type occupies 2 bytes of space in the database

Span style= "Font-size:12px;font-family:verdana;color:rgb (50,62,50);" >tinyint

int

tinyint data type can store integers from 0 to 255. It is useful when you only intend to store a limited number of values. This data type occupies 1 bytes in the database

Span style= "Font-size:12px;font-family:verdana;color:rgb (237,28,36);" >numeric

exact numeric type

numeric data type is the same as decimal type

Span style= "Font-size:12px;font-family:verdana;color:rgb (50,62,50);" >decimal

exact numeric type

decimal data type can be used to store numeric data of fixed precision and range from 1038-1 to 1038-1. When you use this data type, you must specify the range and precision. The range is the total number of digits that can be stored around the decimal point. The precision is the number of digits of the number stored to the right of the decimal point

Span style= "Font-size:12px;font-family:verdana;color:rgb (237,28,36);" >money

currency type

money data type is used to represent money and currency values. This data type can store data from 922 billion to 922 billion, accurate to the currency unit of one out of 10,000

Span style= "Font-size:12px;font-family:verdana;color:rgb (50,62,50);" >smallmoney

currency type

smallmoney data type is used to represent money and currency values. This data type can store data from 214748.3648 to 214748.3647, accurate to the currency unit of one out of 10,000

Span style= "Font-size:12px;font-family:verdana;color:rgb (237,28,36);" >float

approximate numeric type

float data type is an approximate numeric type that is used by floating point numbers. It is said that the floating-point number is approximate, because not all the numbers in its range can be accurately represented. Floating-point numbers can be any number from -1.79E+308 to 1.79E+308

Span style= "Font-size:12px;font-family:verdana;color:rgb (50,62,50);" >real

approximate numeric type

real data types are approximate numeric types like floating-point numbers. It can represent a floating-point number between -3.40E+38 and 3.40E+38

Span style= "Font-size:12px;font-family:verdana;color:rgb (237,28,36);" >datetime

datetime data type is used to represent the date and time. This data type stores all date and time data from January 1, 1753 to December 31, 9999, accurate to 1% seconds or 3.33 milliseconds

Span style= "Font-size:12px;font-family:verdana;color:rgb (50,62,50);" >smalldatetime

smalldatetime data type used to represent dates and hours from January 1, 1900 to June 6, 2079 To a minute.

Span style= "Font-size:12px;font-family:verdana;color:rgb (50,62,50);" >cursor

Special data type

cursor data type is a special data type that contains a reference to a cursor. This data type is used in stored procedures and cannot be used when creating a table

Span style= "Font-size:12px;font-family:verdana;color:rgb (50,62,50);" >timestamp

Special data type

timestamp data type is a special type of data that is used to create a database-wide unique digital. There can be only one timestamp column in a table. Each time you insert or modify a row, the value of the timestamp column changes. Although it has "time" in its name, the timestamp column is not a date that people can recognize. In a database, the timestamp value is unique

Span style= "Font-size:12px;font-family:verdana;color:rgb (50,62,50);" >uniqueidentifier

Special data type

uniqueidentifier data type is used to store a globally unique identifier, That is, the GUID. The GUID is truly globally unique. This number has little chance of being rebuilt in another system. You can use the NEWID function or convert a string to a unique identifier to initialize a column with a unique identifier

Span style= "Font-size:12px;font-family:verdana;color:rgb (237,28,36);" >char

character type

char data type is used to store fixed-length, non-uniform encoded data of specified lengths. When you define a column for this type, you must specify a column length. This data type is useful when you always know the length of the data you want to store. For example, when you store data by zip code plus 4 character formatting, you know that you always need to use 10 characters. The column width of this data type is up to 8,000 characters

Span style= "Font-size:12px;font-family:verdana;color:rgb (237,28,36);" >varchar

character type

varchar data type, like the char type, is used to store non-uniform encoded character data. Unlike the char type, this data type is variable length. When you define a column for that data type, you specify the maximum length of the columns. The biggest difference to the char data type is that the length of the store is not a column long, but the length of the data

Span style= "Font-size:12px;font-family:verdana;color:rgb (50,62,50);" >text

character type

text data type is used to store a large number of non-uniform encoded character data. This data type can have a maximum of 231-1 or 2 billion characters

Span style= "Font-size:12px;font-family:verdana;color:rgb (237,28,36);" >nchar

uniform coded character type

nchar data type is used to store fixed-length, uniformly encoded character data. Uniform encoding uses a double-byte structure to store each character, rather than a single byte (in normal text). It allows for a large number of extended characters. This data type can store 4000 characters, and increases the byte space used by

Span style= "Font-size:12px;font-family:verdana;color:rgb (237,28,36);" >nvarchar

uniform coded character type

nvarchar data type is used as a uniformly encoded character type data that is variable length. This data type can store 4000 characters, and the byte space used increases by one times

Span style= "Font-size:12px;font-family:verdana;color:rgb (50,62,50);" >ntext

uniform coded character type

ntext data type is used to store a large number of uniformly encoded character-type data. This data type can store 230-1 or nearly 1 billion characters, and the byte space used increases by one times

Span style= "Font-size:12px;font-family:verdana;color:rgb (50,62,50);" >binary

binary data type

binary data type is used to store fixed-length binary data up to 8000 bytes long. You should use this data type

Span style= "Font-size:12px;font-family:verdana;color:rgb (50,62,50);" >varbinary

binary data type

varbinary data type is used to store variable-length binary data up to 8000 bytes long. You should use this data type

Image

Binary data types

The image data type is used to store variable-length binary data up to 231-1 or approximately 2 billion bytes

The above are all data types in SQL Server, where several of the flags red are generally common.


Data type collation commonly used in SQL Server

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.