USER_NAME function returns a user database username from a given identification number.
Syntax of USER_NAME Function :
USER_NAME ([ id ])
id is an identification number. It is an integer.
Return type of USER_NAME function is a nvarchar(256).
Examples of USER_NAME Function :
Example 1 : Use of USER_NAME function in select clause
Output
guest
Above example returns user name for an id 2 of current database.