Link to home
Start Free TrialLog in
Avatar of cleaverX
cleaverX

asked on

mysql: convert 2 bytes from blob to integer

Hi,

I have a BLOB field and i want to take 2 bytes from it and use them as an integer.  How can i do this?  

EG:
select substr(blobfield,195,2) as value1 from mytable;

the 2 bytes on position 195 and 196 are an integer that was stored inside a blob field.

How can i get the integer back in mysql, so i can perform a where / having on this value ?






ASKER CERTIFIED SOLUTION
Avatar of Aleksandar Bradarić
Aleksandar Bradarić
Flag of Serbia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cleaverX
cleaverX

ASKER

first part * 256 + second part does the job.
Strange that there is no working cast for this... (not that I know) ?

Thanks for the solution leannonn !