Collections:
Binary String Data Types in SQL Server Transact-SQL
What are binary string data types supported in SQL Server Transact-SQL?
✍: FYIcenter.com
Binary string data types are used to hold binary character strings.
There are 3 binary string data types supported in SQL Server Transact-SQL:
1. BINARY - Used to hold binary strings of a fixed length, specified in the format of BINARY(n), where n defines the string length as number of bytes. The maximum length of BINARY is 8,000 bytes.
The storage size of BINARY(n) is fixed to n bytes, regardless of the length of the string value.
2. VARBINARY (or BINARY VARYING) - Use to hold binary strings of variable lengths, specified in the format of VARBINARY(n), where n defines the string length as number of bytes. The maximum length of VARBINARY is 8,000 bytes.
The storage size of VARBINARY(n) is flexible up to n+2 bytes, depending on the length of the string value. The extra 2 bytes are used to store the length of the string value.
3. IMAGE - Use to hold binary strings of very large lengths. IMAGE uses the BLOB (Binary Large OBject) technology to store string values. IMAGE can store string values of variable lengths up to 2^31-1 (2,147,483,647) bytes.
Here are some example on how to write exact numeric literals:
PRINT 0x41424344; -- BINARY(4) PRINT 0x4100420043004400; -- BINARY(8)
⇒ DECLARE Statements in SQL Server Transact-SQL
⇐ Differences of CHAR and VARCHAR in SQL Server Transact-SQL
2017-04-04, 1631🔥, 0💬
Popular Posts:
What Is "mysqld" in MySQL? "mysqld" is MySQL server daemon program which runs quietly in background ...
How to download and install Microsoft .NET Framework Version 2.0 in SQL Server? .NET Framework Versi...
How To Get Year, Month and Day Out of DATETIME Values in SQL Server Transact-SQL? You can use DATEPA...
How To End a Stored Procedure Properly in SQL Server Transact-SQL? Where the end of the "CREATE PROC...
How to connect SQL Server Management Studio Express to SQL Server 2005 Express in SQL Server? Once y...