DB2 10.5 for Linux, UNIX, and Windows

CURRENT CLIENT_USERID special register

The CURRENT CLIENT_USERID (or CLIENT USERID) special register contains the value of the client user ID from the client information specified for this connection.

The data type of the register is VARCHAR(255). The default value of this register is an empty string.

The value of the client user ID can be changed by using the sqleseti API or the wlm_set_client_info procedure.

Note that the value provided via the sqleseti API is in the application code page, and the special register value is stored in the database code page. Depending on the data values used when setting the client information, truncation of the data value stored in the special register may occur during code page conversion.

A client sends the default client information register values to the DB2® for z/OS® server when they are not explicitly set by the user. The default CURRENT CLIENT_USERID special register value is the user ID that is specified for a connection. The sqleqryi API can return the default value only when the enableDefaultClientInfo keyword is set to True in the IBM® data server driver configuration file.

Example: Find out in which department the current client user ID works.
   SELECT DEPT
     FROM DEPT_USERID_MAP
     WHERE USER_ID = CURRENT CLIENT_USERID