data types for SQL Server

Source: Internet
Author: User
Tags microsoft sql server ranges
Data types for 1.SQL server
Data class is a property of data that represents the type of information that the data represents. Any computer language defines its own data type. Of course, different programming languages have different characteristics, the types of data defined and the names are more or less different. SQL Server provides 25 types of data:
· Binary [(N)]
· Varbinary [(N)]
· Char [(N)]
· varchar[(N)]
· nchar[(N)]
· nvarchar[(N)]
· Datetime
· smalldatetime
· decimal[(P[,s])]
· numeric[(P[,s])]
· float[(N)]
· Real
· Int
· Smallint
· Tinyint
· Money
· SmallMoney
· Bit
· Cursor
· Sysname
· Timestamp
· uniqueidentifier
· Text
· Image
· Ntext (1) Binary data type
Binary data includes Binary, Varbinary, and Image
The Binary data type can be either fixed-length (Binary) or variable-length.
binary[(n)] is n-bit fixed binary data. Where the value of n ranges from 1 to 8000. The size of its storage scenting is n + 4 bytes.
varbinary[(N)] is an n-bit variable-length binary data. Where the value of n ranges from 1 to 8000. The size of its storage scenting is n + 4 bytes, not n bytes.
The data stored in the Image data type is stored in a bit string, not interpreted by SQL Server, and must be interpreted by the application. For example, an application can store data in an Image data type using BMP, Tief, GIF, and JPEG formats.
(2) Character data type
The types of character data include Char,varchar and Text
Character data is data that is any combination of letters, symbols, and numbers.
Varchar is a variable length character data that is no longer than 8KB. Char is a fixed-length character data with a maximum length of 8KB. More than 8KB of ASCII data can be stored using the text data type. For example, because Html documents are all ASCII characters and, in general, longer than 8KB, these documents can be stored in SQL Server with the Text data type.
(3) Unicode Data types
Unicode data types include Nchar,nvarchar and ntext
In Microsoft SQL Server, traditional non-Unicode data types allow you to use characters defined by a particular character set. Allows you to select a character set during SQL Server Setup. With Unicode data types, you can store any character defined by the Unicode standard in a column. In the Unicode standard, all the characters defined in various character sets are included. Using Unicode data types, the prevailing scenting is twice times the size of the scenting used for non-Unicode 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.