USER_NAME Function [System]

Returns the user name.

Syntax

USER_NAME ( [ user-id ] )

Parameters

Parameter

Description

user-id

The user identification number.

Returns

LONG VARCHAR

Note: The result data type is a LONG VARCHAR. If you use USER_NAME in a SELECT INTO statement, you must have an Unstructured Data Analytics Option license, or use CAST and set USER_NAME to the correct data type and size.

Standards and Compatibility

  • SQL—Vendor extension to ISO/ANSI SQL grammar.

  • Sybase—Adaptive Server function implemented for SAP Sybase IQ. In Adaptive Server, USER_NAME returns the user name, not the server user name.

Example

The following statement returns the value “DBA”:

SELECT USER_NAME ( 1 ) FROM iq_dummy

The following statement returns the value “SYS”:

SELECT USER_NAME ( 0 ) FROM iq_dummy
Related reference
SUSER_ID Function [System]
SUSER_NAME Function [System]
USER_ID Function [System]