CURRENT_ROLE Operator

The CURRENT_ROLE operator returns a string that contains the name of the currently enabled role of the user who is running the session. This role was either set in the session explicitly, using the SET ROLE statement, or else implicitly as a default role when the current user connected to the database. If the user holds no role, or if no role that was granted to the user is currently enabled, CURRENT_ROLE returns a NULL value. If the user has been granted no role individually, but a default role has been granted to PUBLIC, and this default role has been explicitly or implicitly enabled, CURRENT_ROLE returns the name of this default role.

The next statement shows how you might use the CURRENT_ROLE operator:
select CURRENT_ROLE FROM systables WHERE tabid = 1;

The CURRENT_ROLE operator does not change the lettercase of the identifier of a role. If you use CURRENT_ROLE in an expression and your current role is Czarina, the CURRENT_ROLE operator returns Czarina, not czarina.

If you specify CURRENT_ROLE as the default value for a column, the column must have a CHAR, VARCHAR, LVARCHAR, NCHAR, or NVARCHAR data type. Because the name of a role is an authorization identifier, truncation might occur if the column length is less than 32 bytes.