SQL SERVER Data Type

Source: Internet
Author: User

SQL SERVER Data Type


The following lists various SQL Server data types:

SQL numeric type:

Data Type Range Storage
Bigint -9,000,000,000,000,000,000
To 9,000,000,000,000,000,000
8 bytes
Bit 1 or 0 1 byte
Decimal

 

Varies
Int -From 2,000,000,000 to 2,000,000,000 4 bytes
Money -922,337,203,685,477.508 to 922,337,203 685, 477.5807 8 bytes
Numeric    
Smallint -From 32,000 to 32,000 2 bytes
Smallmoney -From 214,748.3648 to 214,748.3647 4 bytes
Tinyint 0 to 255 1 byte












The identifier data type is usually used for scientific computation or for approximate numeric type.

Data Type Range Storage
Float    
Real    




Date and Time type:

Store date and time in different formats

Data Type Range Storage
Date 10 3 bytes
Datetime2 19 to 27 Varies
Datetime 19 to 23 8 bytes
Datetimeoffset 26 to 34 10 bytes
Smalldatetime 19 4 bytes
Time 8 to 16 5 bytes

 

 

 

 





String type:

It is usually used to store English strings.

Data Type Range Storage
Char 1 to 8,000 Varies
Text 2,000,000,000 Varies
Varchar 8,000 Varies





UNICODE string type:

It is usually used to store a variety of non-English language strings, such as Chinese.

Data Type Range Storage
Nchar 1 to 4,000 Varies
Ntext 1,000,000,000 Varies
Nvarchar 4,000 Varies





Binary data type:

Data Type Range Storage
Binary   Varies
Image   Varies
Varbinary   Varies

 

 



Other data types:

Data Type Range Storage
Cursor    
Hierarchyid    
SQL _variant    
Table    
Timestamp    
Uniqueidentifier    
Xml    








GUID, NEWID (), NEWSEQUENTIALID () See http://blog.csdn.net/leewhoee/article/details/8561583


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.