ifx_node_id() function

The ifx_node_id() function returns the ID of the grid server on which the function is run.

Syntax


1  EXECUTE FUNCTION ifx_node_id ( ) ;

Usage

Use the ifx_node_id() function in the context of a grid query to return the ID of each server on which the grid query is run. Include the ifx_node_id() function in the SELECT statement of a grid query. The server ID is returned as a result column to identify the origin of the other results of the query.

If you run the ifx_node_id() function outside of the context of a grid query, the function returns the ID of the local server, unless you prefix the remote database and server name, for example: db@serv4:ifx_node_id().

Example

The following grid query selects the server ID and the total sales from a grid named SE_USA and groups the results by the server ID:

SELECT ifx_node_id() AS ifx_node_id, sum(amt) AS total_sales
FROM sales GRID ALL 'SE_USA'
GROUP BY ifx_node_id;

ifx_node_id      total_sales

          1         $2100.00
          2         $2160.00
          3         $2000.00
          4         $2040.00