USER_NAME() Function in SQL Server Last Updated : 21 Jan, 2021 Comments Improve Suggest changes Like Article Like Report USER_NAME() : This function in SQL Server is used to return the username of the database that is based on the id stated. Features : This function is used to find the username of the database used.This function comes under Advanced Functions.This function accepts only one parameter i.e, id number.This function returns the current user's name in case the id number is not specified. Syntax : USER_NAME(id_number) Parameter : This method accepts only one parameter. id_number - Specified id number in the database of the user. It is optional. Returns : It returns the username of the specified id number. Moreover, if the id number is not specified then it returns the current username. Example-1 : Using the USER_NAME() function and getting the username with no id number. SELECT USER_NAME(); Output : nidhi Here, the id number is not provided so, the current user's name is returned. Example-2 : Using the USER_NAME() function and getting the username of the specified id number. SELECT USER_NAME(2); Output : Geek Example-3 : Using the USER_NAME() function and getting the username of the specified id number using a variable. DECLARE @id INT; SET @id = 3; SELECT USER_NAME(@id); Output : INFORMATION_SCHEMA Example-4 : Using the USER_NAME() function and getting the username of the specified id number using the CAST() function. SELECT USER_NAME(CAST(2.2 as int)); Output : Geek Application : This function is used to find the username of the database used. Comment More infoAdvertise with us Next Article USER_NAME() Function in SQL Server N nidhi1352singh Follow Improve Article Tags : SQL DBMS-SQL SQL-Server Similar Reads UPPER() function in SQL Server The UPPER() function in SQL Server is a useful tool for converting all characters in a string to uppercase. This function is essential for ensuring uniform text formatting and for performing case-insensitive comparisons.In this article, We will learn about the UPPER() function in SQL Server by under 3 min read QUOTENAME() Function in SQL Server QUOTENAME() function : This function in SQL Server is used to return a Unicode string with delimiters added in order to make the string a valid SQL Server delimited identifier. Features : This function is used to find a Unicode string with delimiters added. This function accepts only strings and del 3 min read SYSTEM_USER() Function in SQL Server SYSTEM_USER() function :This function in SQL Server is used to return the current user's login name.Features : This function is used to find the current user's login name.This function comes under Advanced Functions.This function doesn't accept any parameter. Syntax : SYSTEM_USER; Parameter :This me 2 min read SESSION_USER() Function in SQL Server SESSION_USER() : This function in SQL Server is used to return the current user's name in the database of SQL Server that is in use. Features : This function is used to find the current user's name.This function comes under Advanced Functions.This function doesn't accept any parameter. Syntax : SESS 2 min read UNICODE() Function in SQL Server In this article, we are going to cover UNICODE() function where you will see the Unicode for given specific character or for expression character. UNICODE() : It is the function that gets the integer value for the first character of the input expression, as defined by the Unicode standard. Syntax : 1 min read Like