Common Data Types of SQL server

Source: Internet
Author: User

Common Data Types in SQL server:

Binary
A fixed-length binary data with a maximum length of 8,000 bytes.

Varbinary
A variable-length binary data with a maximum length of 8,000 bytes.

Image
A variable-length binary data with a maximum length of 2G +-1 (2,147,483,647) bytes

Text
The variable length of non-Unicode data in the server code page cannot exceed 2G + (2,147,483,647) characters. When the server code page uses double-byte characters, the storage volume is still 2,147,483,647 bytes. The storage size may be less than 2,147,483,647 bytes (depending on the string ).

Image
The variable-length binary data is between 0 and 2G + (2,147,483,647) bytes.

-- Binary and varbinary
Binary data type of a fixed length (binary) or variable length (varbinary.

Binary [(n)]
A fixed length of n Bytes of binary data. N must be from 1 to 8,000. The storage space is n + 4 bytes.

Varbinary [(n)]
N Bytes of variable-length binary data. N must be from 1 to 8,000. The size of the bucket is the length of the actual input data plus 4 bytes, rather than n Bytes. The input data length may be 0 bytes. The synonym for varbinary in the SQL-92 is binary varying.
Note
1. If n is not specified in the data definition or variable declaration statement, the default length is 1. If n is not specified by the CAST function, the default length is 30.
2. Use binary when the column data items are of the same size.
3. When the column data item sizes are inconsistent, use varbinary

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.