On 28.06.2006 13:54, Dušan Pavlica wrote:
> Hello,
> I have column of type char(2) containing hex numbers (e.g. "0A", "FF",
> ...) and I cannot find correct function which could convert those hex
> numbers to integers so I can perform futher calculations. I experimented
> with HEX(), CAST(), CONVERT() but I wasn't succesfull.
>
> Thanks in advance,
> Dusan
>
Use conv:
mysql> select conv('11', 16, 10);
+--------------------+
| conv('11', 16, 10) |
+--------------------+
| 17 |
+--------------------+
1 row in set (0.01 sec)
mysql> select conv('0a', 16, 10) + conv('a0', 16, 10);
+-----------------------------------------+
| conv('0a', 16, 10) + conv('a0', 16, 10) |
+-----------------------------------------+
| 170 |
+-----------------------------------------+
See: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html
HTH,
Wolfram
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]