美好的一天!
我有一个带有二进制列C1的表T1(在MariaDB中)。 它有一些字节。
当我选择十六进制时,我有以下内容:
select HEX(SUBSTRING((select C1 from T1 where <some restrictions>), 254, 2));
+----------------------------------------------------------------------+
| HEX(SUBSTRING((select C1 from T1 where <some restrictions>), 254, 2)) |
+----------------------------------------------------------------------+
| 1200 |
+----------------------------------------------------------------------+
但我未能将结果转换为INT:
select cast((SUBSTRING((select C1 from T1 where <some restrictions>), 254, 2)) as int);
+--------------------------------------------------------------------------------+
| cast((SUBSTRING((select C1 from T1 where <some restrictions>), 254, 2)) as int) |
+--------------------------------------------------------------------------------+
| 0 |
+--------------------------------------------------------------------------------+
所以,我的问题是-为什么会发生,如何将二进制转换为int?