Collections:
CONV() - Binary/HEX String and Integer Conversion
How to perform binary/hexadecimal string and integer conversion using the CONV() function?
✍: FYIcenter.com
CONV(N, from_base, to_base) is a MySQL built-in function that
allows you to perform binary/hexadecimal string and integer conversion.
For example:
SELECT CONV('FF', 16, 10), CONV('FF', 16, 2);
-- +--------------------+-------------------+
-- | CONV('FF', 16, 10) | CONV('FF', 16, 2) |
-- +--------------------+-------------------+
-- | 255 | 11111111 |
-- +--------------------+-------------------+
SELECT CONV(255, 10, 2), CONV(255, 10, 16);
-- +------------------+-------------------+
-- | CONV(255, 10, 2) | CONV(255, 10, 16) |
-- +------------------+-------------------+
-- | 11111111 | FF |
-- +------------------+-------------------+
Reference information of the CONV() function:
CONV(in, from_base, to_base) : out Converts numbers between different number bases. Returns a string representation of the number N, converted from base from_base to base to_base. Returns NULL if any argument is NULL. Arguments, return value and availability: in: Required. The input number in from_base base. out: Return value. The output number in to_base base. Available since MySQL 5.7.
⇒ ELT() - String at Given Index
⇐ CONCAT_WS() - Concatenation with Separator
2023-11-13, 1132🔥, 0💬
Popular Posts:
What Is the Difference Between GETDATE() and GETUTCDATE() in SQL Server Transact-SQL? The difference...
What Happens to Your Transactions When ERROR 1205 Occurred in MySQL? If your transaction receives th...
What are single-byte character string data types supported in SQL Server Transact-SQL? Single-byte c...
How To Convert Numeric Values to Integers in SQL Server Transact-SQL? Sometimes you need to round a ...
How to download and install SQL Server 2005 Sample Scripts in SQL Server? If you want to learn from ...