我在mysql中有这样一段代码
1
2
3
4
5
6
7
8
|
declare @byte1 binary (1) declare @byte2 binary (1) declare @ smallint smallint set @ smallint = 675 set @byte1 = @ smallint & 0xFF set @byte2 = (@ smallint & 0xFF00) / 0x100 select @byte1 a, @byte2 b, @byte1+@byte2 c |
执行结果是:
a b c
0xA3 0x02 0xA302
from: http://bbs.csdn.net/topics/360146372