Several data types commonly used by SQL Server _mssql
Source: Internet
Author: User
Several types of data commonly used in SQL Server:
Binary
Fixed-length binary data with a maximum length of 8,000 bytes.
varbinary
Variable-length binary data with a maximum length of 8,000 bytes.
Image
Variable-length binary data with a maximum length of 2g+-1 (2,147,483,647) bytes
Text
The maximum length of variable-length non-Unicode data in the server code page is 2g+ (2,147,483,647) characters. When the server code page uses double-byte characters, the storage is still 2,147,483,647 bytes. The storage size may be less than 2,147,483,647 bytes (depending on the string).
Image
Variable-length binary data is between 0 and 2g+ (2,147,483,647) bytes
--binary and varbinary
Fixed-length (binary) or variable-length (varbinary) binary data types.
binary [(n)]
Fixed-length n-byte binary data. N must be from 1 to 8,000. The storage space size is n+4 bytes.
varbinary [(N)]
N-byte variable-length binary data. n must be from 1 to 8,000. The storage space size is the actual input data length + 4 bytes instead of n bytes. The data entered may be 0 bytes long. The synonym of varbinary in SQL-92 is binary varying.
Comments
1. If n is not specified in a data definition or variable declaration statement, the default length is 1. If n is not specified with the CAST function, the default length is 30.
2. Use binary when column data items are the same size.
3. Use varbinary when column data item size is inconsistent
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.