Ip4 address to integer conversion in DBT SQL (alternaltive to inet_aton function)

Hi ,
I need to convert String IP4 address to integer and in PHP I used inet_aton and the function is not working in the sql query in dbt model.
Please let me know the alternative for inet_aton or any other ways to convert ip4 address to integer

Fixed it with below ```
SPLIT_PART(ipAddr, ‘.’, 1)* 16777216::bigint +
SPLIT_PART(ipAddr, ‘.’, 2)* 65536::bigint +
SPLIT_PART(ipAddr, ‘.’, 3)* 256::bigint +
SPLIT_PART(ipAddr, ‘.’, 4)::bigint as ip_integer

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.