BIN()
BIN() — Returns the binary representation of a BIGINT value as a string.
Synopsis
BIN( value )
Description
The BIN() function returns the binary representation of a BIGINT value as a string. The function will return the shortest valid string representation, truncating any preceding zeros (except in the case of the value zero, which is returned as the string "0").
Example
The following example use the BIN and BITAND functions to return the binary representations of two BIGINT values and their binary intersection.
$ sqlcmd 1> create table bits (a bigint, b bigint); 2> insert into bits values(55,99); 3> select bin(a) as int1, bin(b) as int2, 4> bin(bitand(a,b)) as intersection from bits; INT1 INT2 INTERSECTION -------- --------- ------------- 110111 1100011 100011
Documentation