Search code examples
azure-data-explorerkqlkusto-explorer

Is there a way to convert string to binary in Kusto


I am trying to convert a hexadecimal value to a binary string within a Kusto query, but cannot find any method of doing this in the Kusto documentation / StackOverflow. I see that SQL has this method, but in my case I must use Kusto.


Solution

  • Kusto's scalar data types do not include binary, bytearray etc.

    If I get your intention correctly, you are looking for something like this:

    print hex_str = '48656c6c6f20576f726c64'
    | mv-apply c = extract_all('(..)', hex_str) on (summarize str = make_string(make_list(toint(strcat('0x', c)))))
    
    hex_str str
    48656c6c6f20576f726c64 Hello World

    Fiddle