Document toolboxDocument toolbox

IPv6 host number (host)

Description

Returns the host number of an IPv6 address.

How does it work in the search window?

Select Create column in the search window toolbar, then select the IPv6 host number operation. You need to specify one argument:

Argument

Data type

Argument

Data type

IPv6 mandatory

ip6

The data type of the values in the new column is integer.

Example

In the demo.ecommerce.data table, we want to get the host number of the clientIpAddress column. To do it, we need to transform it first into IPv6 format using the To IPv6 (ip6) operation. Then, click Create column on the query toolbar and select the IPv6 host number operation.

The arguments needed to create the new column are:

  • IPv6 →  clientIpAddressIPv6 column obtained from the previous conversion operation.

Click Create column and you will see the following result:

How does it work in LINQ?

When using the search window interface to manually introduce the argument instead of using a column, the To IPv6 (ip6) operation will be transparently performed to convert the string specified into an ip6 data type. This means that you will not notice that such an intermediate step exists. 

Though this conversion is implicit while using the search window interface, it must be explicitly done when writing the query in LINQ, as shown in the second example below.

Use the operator select... as...  and add the operation syntax to create the new column. This is the syntax for the IPv6 host number operation:

  • host(ip6)

Example

You can copy the following LINQ script and try the above example on the demo.ecommerce.data table.

from demo.ecommerce.data select ip6(clientIpAddress) as clientIpAddressIPv6, host(clientIpAddressIPv6) as IPv6HostNumber

You can copy the following LINQ script to see how the string conversion must be explicitly performed in LINQ when specifying the argument instead of using a column.

from demo.ecommerce.data select host(ip6("2001:db8:85a3::8a2e:370:7334")) as IPv6HostNumber