CURRENT CLIENT_USERID

The CURRENT CLIENT_USERID special register specifies a VARCHAR(255) value that contains the value of the client user ID from the client information specified for Start of changethe current connection.End of change

The default value of this register is the empty string. The value of the client user ID can be changed through three interfaces.
  • The Set Client Information (SQLESETI) API can change the client special register.
  • In CLI, SQLSetConnectAttr() can be used to set the SQL_ATTR_INFO_USERID connection attribute.
  • Start of changeIn ODBC, SQLSetConnectAttr() can be used to set the ODBC_ATTR_INFO_USERID connection attribute.End of change
  • In JDBC, the setClientInfo connection method can be used to set the ClientUser connection property.

Example

Find out in which department the current client user ID works.

   SELECT  DEPT
   FROM DEPT_USERID_MAP
   WHERE USER_ID = CURRENT CLIENT_USERID