0
我已經能夠與substring(colname, N, 1)
獲得的第N個字節出了場,但在這一點上似乎無法治療的結果爲二進制:如何在varbinary列的第N個字節上執行二進制操作?
> select substring(colname, N, 1) from [...]
\
> select hex(substring(colname, N, 1)) from [...]
5C
> select hex(substring(colname, N, 1) & 0xff) from [...]
0
> select cast(substring(colname, N, 1) as unsigned integer) from [...]
0
相比:
> select cast(0x5c as binary);
\
> select hex(0x5c & 0xff);
5C
> select cast(0x5c as unsigned integer);
92
我想直到結束是這樣的:
> select [...] where substring(colname, N, 1) & 0b00100000 = 0b00100000;
這個工程,但爲什麼? – l0b0
你需要你的第N個字符的代碼才能使用它。函數ascii(..)返回字符的代碼。 –