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 aaa
, bbb
, ccc
, 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) |
Argument | Required? | Data Type | Description |
---|---|---|---|
column_ipaddr | Y | string | Column name or string literal identifying the IP address to convert to an integer value |
Name of the column or IP address literal whose values are used to compute the equivalent integer value.
Required? | Data Type | Example Value |
---|---|---|
Yes | String literal or column reference (IP address) | 4.3.2.1 |