SQL SERVER data type details Supplemental 2_mssql

Source: Internet
Author: User
Data type
Type
Description
Bit
Integral type
The bit data type is an integral type, and its value can only be 0, 1, or null. This data type is used to store data that has only two possible values, such as Yes or no, True or FA LSE, on, or off
Int
Integral type
An int data type can store integers from 231 (-2147483648) to 231 (2147483 647). Almost all numeric data stored in a database can be of this type of data. This data type occupies 4 bytes in the database
smallint
Integral type
The smallint data type can store integers from 215 (-32768) to 215 (32767). This data type is useful for storing numeric data that is often limited to a specific range. This data type occupies 2 bytes of space in the database
tinyint
Integral type
The tinyint data type can store integers from 0 to 255. It is useful when you are only going to store a limited number of values. This data type occupies 1 bytes in the database
Numeric
Exact numeric type
Numeric data type is the same as the decimal type
Decimal
Exact numeric type
The 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. Precision is the number of digits stored to the right of the decimal point
Money
Currency type
The Money data type is used to represent the monetary and currency values. This data type can store data from 922 billion to 922 billion, accurate to one out of 10,000 of the monetary unit
SmallMoney
Currency type
The 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 one out of 10,000 of the monetary unit
Float
Approximate numeric type
The float data type is an approximate numeric type that is used by floating-point numbers. Floating-point numbers are approximate because not all numbers in their range can be accurately represented. Floating point numbers can be any number from -1.79E+308 to 1.79E+308
Real
Approximate numeric type
Real data types, like floating-point numbers, are approximate numeric types. It can represent a floating-point number between -3.40E+38 and 3.40E+38.
Datetime
Date-Time Type
datetime data types are used to represent dates and times. This data type stores all date and time data from January 1, 1753 through December 9999 3 1st, accurate to 1% seconds or 3.33 milliseconds
smalldatetime
Date-Time Type
The smalldatetime data type is used to indicate the date and time from January 1, 1900 to June 6, 2079, accurate to one minute
Cursor
Special Data type
The cursor data type is a special type of data that contains a reference to a cursor. This data type is used in stored procedures and cannot be used when creating tables
Timestamp
Special Data type
The timestamp data type is a special type of data used to create a unique digital database-wide range. 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 identify. In a database, the timestamp value is unique
uniqueidentifier
Special Data type
The uniqueidentifier data type is used to store a globally unique identifier, the GUID. The GUID is indeed globally unique. This number has little chance of being rebuilt in another system. You can initialize a column with a unique identifier by using the NEWID function or by converting a string to a unique identifier
Char
Character type
The char data type is used to store data of a fixed-length, non-uniform encoding of specified lengths. When defining a column for this type, you must specify the 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 adding 4 characters to your zip code, you know that you always need to use 10 characters. This data type has a maximum width of 8,000 characters
varchar
Character type
The varchar data type, like the char type, is used to store the data for non-uniform encoded characters. Unlike the char type, this data type is variable length. When you define a column as the data type, you specify the maximum length of the columns. The biggest difference between it and char data type is that the length of the store is not a column long, but the length of the data
Text
Character type
The 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
NChar
Unified coded Character type
NCHAR data types are used to store fixed-length, uniformly encoded character data. Unified encoding uses a DOUBLE-BYTE structure to store each character, rather than a single byte (the case in normal text). It allows a large number of extended characters. This data type can store 4000 characters, and the byte space used increases by one times
nvarchar
Unified coded Character type
The nvarchar data type is used as a variable-length uniform encoded character data. This data type can store 4000 characters, and the byte space used increases by one times
ntext
Unified coded Character type
ntext data types are used to store large numbers of uniformly encoded character data. This data type can store 230-1 or nearly 1 billion characters, and the byte space used increases by one times
Binary
Binary data types
The binary data type is used to store fixed-length binary data up to 8000 bytes long. You should use this data type when the contents of the input table are close to the same length
varbinary
Binary data types
The varbinary data type is used to store variable-length binary data up to 8000 bytes long. You should use this data type when the content size of the input table is variable
Image
Binary data types
The image data type is used to store the variable-length binary data, up to 231-1 or approximately 2 billion bytes

The following is the article published before, the need for friends can be consulted together under:
SQL data Type detailed
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.