Collections:
CONV() - Number Base Conversion
How to convert an integer from one number base to another using the CONV() function?
✍: FYIcenter.com
CONV(str, from_base, to_base) is a MySQL built-in function that
converts an integer from one number base to another.
For example:
SELECT CONV(1279, 10, 16), CONV('4FF', 16, 10);
-- +--------------------+---------------------+
-- | CONV(1279, 10, 16) | CONV('4FF', 16, 10) |
-- +--------------------+---------------------+
-- | 4FF | 1279 |
-- +--------------------+---------------------+
SELECT CONV(1279, 10, 8), CONV('2377', 8, 10);
-- +-------------------+---------------------+
-- | CONV(1279, 10, 8) | CONV('2377', 8, 10) |
-- +-------------------+---------------------+
-- | 2377 | 1279 |
-- +-------------------+---------------------+
SELECT CONV(1279, 10, 2), CONV('10011111111', 2, 10);
-- +-------------------+----------------------------+
-- | CONV(1279, 10, 2) | CONV('10011111111', 2, 10) |
-- +-------------------+----------------------------+
-- | 10011111111 | 1279 |
-- +-------------------+----------------------------+
Reference information of the CONV() function:
CONV(str, from_base, to_base): mewstr converts an integer from one number base to another. Arguments, return value and availability: str: Required. The integer string in from_base base. mewstr: Return value. The converted integer string to_base base. Available since MySQL 4.0.
Related MySQL functions:
⇒ COS() - Cosine Trigonometric Value
⇐ CEILING() - Rounding up to Integer
2023-12-19, 1048🔥, 0💬
Popular Posts:
How to download and install the scaled-down database AdventureWorksLT in SQL Server? If you want to ...
How To Calculate Age in Days, Hours and Minutes in SQL Server Transact-SQL? On many Web sites, news ...
How To Provide Default Values to Function Parameters in SQL Server Transact-SQL? If you add a parame...
Why I Can Not Enter 0.001 Second in DATETIME values in SQL Server Transact-SQL? If you enter millise...
How to download and install Microsoft .NET Framework Version 2.0 in SQL Server? .NET Framework Versi...