SET CURRENT SQLID statement
The SET CURRENT SQLID statement assigns a value to the CURRENT SQLID special register.
Invocation for SET CURRENT SQLID
This statement can be embedded in an application program or issued interactively. It is an executable statement that can be dynamically prepared. The value to which special register CURRENT SQLID is set is used as the SQL authorization ID for dynamic SQL statements only if DYNAMICRULES run behavior is in effect. The CURRENT SQLID value is ignored for the other DYNAMICRULES behaviors.
Authorization for SET CURRENT SQLID
The specified value must be equal to one of the authorization IDs of the application process. This rule always applies, even when SET CURRENT SQLID is issued as a static SQL statement.
- If any of the authorization IDs of the process has SYSADM authority, CURRENT SQLID can be set to any value when the SEPARATE SECURITY system parameter is set to NO. Note that the SEPARATE_SECURITY subsystem parameter does not apply to or affect users with installation SYSADM authority.
- If any of the authorization IDs has the installation SYSOPR authority, CURRENT SQLID can be set to SYSINSTL, regardless of the SEPARATE_SECURITY value.
CURRENT SQLID cannot be set to the name of a role.
Syntax for SET CURRENT SQLID
Description for SET CURRENT SQLID



- SESSION_USER or USER
- Specifies the value of the SESSION_USER (USER) special register.
- string-constant
- Specifies a character string constant of 8 characters or fewer that identifies an authorization ID. The content is not folded to uppercase.
- host-variable
- Specifies a character string constant of 8 characters or fewer that identifies a host variable that contains an authorization ID. The content is not folded to uppercase.

Notes for SET CURRENT SQLID
- Effect on authorization IDs
- SET CURRENT SQLID does not change the primary authorization ID of the process.
If the SET CURRENT SQLID statement is executed in a stored procedure or user-defined function package that has a dynamic SQL behavior other than run behavior, the SET CURRENT SQLID statement does not affect the authorization ID that is used for dynamic SQL statements in the package. The dynamic SQL behavior determines the authorization ID. For more information, see DYNAMICRULES bind option.
- Effect on special register CURRENT PATH
- When the value of the PATH special register depends on the value of the CURRENT SQLID special register, any changes to the CURRENT SQLID special register are not reflected in the value of the PATH special register until a commit operation is performed or a SET PATH statement is issued to change the SQL path to use the new value of the CURRENT SQLID.
- DRDA classification
- SET CURRENT SQLID is executed by the database server and is therefore classified as a non-local SET statement in DRDA.
Examples for SET CURRENT SQLID
- Example 1
- Set the CURRENT SQLID to the primary authorization
ID.
SET CURRENT SQLID = SESSION_USER;
- Example 2
- Set the SQL authorization ID to 'GROUP34' (one of the authorization IDs of the
process).
SET CURRENT SQLID = 'GROUP34';