USER_NAME
USER_NAME is a function in SQL Server. It returns the database username based on the specified user's ID. If no parameter is provided, it returns the name of the current user.
USER_NAME()
Example
Output
Explanation
The USER_NAME()
function in SQL Server returns the database user name based on the specified user ID. If the user ID is not specified, the function will return the name of the current user. In this case, the output ‘dbo’ represents the database owner.