SQL Server Data type

Source: Internet
Author: User

Data Type Start End
bigint -9,223,372,036,854,775,808 9,223,372,036,854,775,807
Int -2,147,483,648 2,147,483,647
smallint -32,768 32,767
tinyint 0 255
Bit 0 1
Decimal -10^38 +1 10^38-1
Numeric -10^38 +1 10^38-1
Money -922,337,203,685,477.5808 +922,337,203,685,477.5807
SmallMoney -214,748.3648 +214,748.3647
Approximate numeric data types:
Data Type Start End
Float -1.79e + 308 1.79E + 308
Real -3.40E + 38 3.40E + 38
Date and time data type:
Data Type Start End
Datetime Jan 1, 1753 Dec 31, 9999
smalldatetime Jan 1, 1900 June 6, 2079
Date Storing data such as: June 30, 1991
Time Store the time of day, such as: 12:30pm.

Note: Here, the date time has a precision of 3.33 milliseconds, while the smalldatetime has 1 accuracy.

String data type:
Data Type Start End
Char Char The maximum length is 8000 characters. (fixed-length non-Unicode characters)
varchar varchar A maximum of 8,000 characters. (Variable-length non-Unicode data)
varchar (max) varchar (max) 231 characters for maximum length, variable length non-Unicode data (SQL Server 2005 only)
Text Text Variable-length non-Unicode data with a maximum length of 2,147,483,647 characters
Unicode character string data type:
Data Type Description
NChar The 4000 character is the maximum length. (fixed-length Unicode)
nvarchar The 4000 character is the maximum length. (variable-length Unicode)
nvarchar (max) 231 characters (only in SQL Server 2005) maximum length (variable-length Unicode)
ntext The maximum length is 1,073,741,823 characters. (variable-length Unicode)
Binary data type:
Data Type Description
Binary 8000 bytes for maximum length (fixed-length binary data)
varbinary The maximum length of 8000 bytes. (Variable-length binary data)
varbinary (max) The maximum length of 231 bytes (only in SQL Server 2005). (Variable-length binary data)
Image The maximum length of 2,147,483,647 bytes. (Variable-length binary data)
Other data types:

Data Type Description
sql_variant Different SQL Servers support the storage value of the data type, in addition to text, ntext, and timestamp
Timestamp Stores unique numbers in the database range, gets each row or update when updated
uniqueidentifier Store globally Unique identifiers (GUIDs)
Xml Stores XML data. XML instances that can store a column or variable (only in SQL Server 2005)
Cursor Referencing the Cursor object
Table Storage for later processing of result sets

SQL Server Data type

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.