The DBPARTITIONNAME function returns the relational database name (database partition name) of where a row is located. If the argument identifies a non-distributed table, an empty string is returned.
For more information about partitions, see the DB2® Multisystem topic collection.
In SQL naming, the table name may be qualified. In system naming, the table name cannot be qualified.
If the argument identifies a view, common table expression, or nested table expression, the function returns the relational database name of its base table. If the argument identifies a view, common table expression, or nested table expression derived from more than one base table, the function returns the partition name of the first table in the outer subselect of the view, common table expression, or nested table expression.
The argument must not identify a view, common table expression, or nested table expression whose outer fullselect subselect includes an aggregate function, a GROUP BY clause, a HAVING clause, a UNION clause, an INTERSECT clause, DISTINCT clause, or VALUES clause. The DBPARTITIONNAME function cannot be specified in a SELECT clause if the fullselect contains an aggregate function, a GROUP BY clause, a HAVING clause, or a VALUES clause. If the argument is a correlation name, the correlation name must not identify a correlated reference.
The data type of the result is VARCHAR(18). The result can be null.
The CCSID of the result is the default CCSID of the current server.
Syntax alternatives: NODENAME is a synonym for DBPARTITIONNAME.
SELECT EMPNO, DBPARTITIONNAME(X), DBPARTITIONNAME(Y) FROM EMPLOYEE X, DEPARTMENT Y WHERE X.DEPTNO=Y.DEPTNO