convert integer to varbinary
Is it possible to convert int value directly into binary data type? For now I figured out that I can cast int to hex string and then convert it to binary like this HEX_TO_BINARY(LPAD(TO_HEX(i & 0xffffffff), 8, '0'))
You can say that there is no need for binary as all binary operators available for integer as well. And I would say that I need varbinary to combine many integer features togeather in a binary hash like this binary_feature1 || binary_feature2 || binary_feature3 || ...
So I'm wondering if there is something more efficient than TO_HEX -> LPAD -> HEX_TO_BINARY to convert int to binary