Logo 
Search:

SQL Server Articles

Submit Article
Home » Articles » SQL Server » System FunctionsRSS Feeds

USER_NAME Function

Posted By: Sarita Patel     Category: SQL Server     Views: 2239

This article explains about USER_NAME function in sql server with examples.

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 

SELECT USER_NAME(2)

Output
guest

Above example returns user name for an id 2 of current database.
  
Share: 


Didn't find what you were looking for? Find more on USER_NAME Function Or get search suggestion and latest updates.

Sarita Patel
Sarita Patel author of USER_NAME Function is from United States.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!