Computes an integer value for a four-octet internet protocol (IP) address. Source value must be a valid IP address or a column reference to IP addresses.

IP addresses must be in the following format:

aaa.bbb.ccc.ddd

where aaabbbccc, and ddd, are integers 0 - 255, inclusive.

NOTE: IPv6 addresses are not supported.

The formula used to compute the integer equivalent of the above IP address is the following:

(aaa * 2563) + (bbb * 2562) + (ccc * 256) + (ddd)

As a result, each valid IP address has a unique integer equivalent.

Numeric literal example:

iptoint('1.2.3.4' )

Output: Returns the integer value 16909060.

Column reference example:

iptoint(IpAddr)

Output: Returns the value of the IpAddr column converted to an integer value. 

iptoint(column_ipaddr)


ArgumentRequired?Data TypeDescription
column_ipaddrYstringColumn name or string literal identifying the IP address to convert to an integer value

column_ipaddr

Name of the column or IP address literal whose values are used to compute the equivalent integer value.

 

Required?Data TypeExample Value
YesString literal or column reference (IP address)4.3.2.1

Example - Convert IP addresses to integers