UserId Function

Official Content
This documentation is valid for:
To return the User Identification.


Type Returned:


Character, it is truncated if the variable is defined in N characters and the user assigned to it is longer than the variable length. 

In the iSeries environment, this function returns the User Identification defined in the User Profile.
In a PC environment, this function returns the users name (using API Windows functions) if the LOGNAME environment variable is not set. Otherwise this variable's value is used. This is the expected behavior whether there is network support or not.
In a Client/Server environment, this function also could return the identification of the user connected to the database server.If the user is not connected, the function returns blank spaces. It must be written using the following syntax : USERID('Server'). The word Server must be written between quotes as shown.


You cannot use this function if the “Connect to server property” has the value “At first request”, and the database has not been accessed yet.


Objects: Procedures, Transactions, Web Panels
Languages: .NET, Ruby, Java, RPG, Visual Basic, Visual FoxPro, Cobol

See Also

Work Station Function