BIN(intag & 255)

Filip Sergeys wrote:
> 
> Hi,
> 
> WHAT DO I WANT TO DO:
> 
> I want to have the binary value of a part of a decimal value.
> 
> 1)I have a decimal value  in column called intag : 262204
> 
> 2)From this value I'am only interested in the last two bits of the HEX value of
>    this decimal
>         HEX value = 4003C
>         My interest 3C
>         part of used SQL query: substring(HEX(intag), (length(HEX(intag))-1), 2)
> 
> 3)For the last two bits(3C) I like to have the binary value
>         HEX value = 3C
>         Binary = 111100
>         Final SQL query: BIN(substring(HEX(intag), (length(HEX(intag))-1), 2))
> 
> PROBLEM
> When running the last query, the returned value is 11 instead of 111100.
> Probably it has something to do with the fact that I requested a substring of
> length 2. What do I need to do to get the complete binary value?
> 
> If one you SQL geniuses knows this, please let me know.
> 
> Thanks in advance
> 
> FS
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail 
><[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to