Logo 
Search:

SQL Server Articles

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

USER_ID Function

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

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

USER_ID returns login identification name from a user's security identification number (SID).

USER_ID can be used in the select list, in the WHERE clause, and anywhere an expression is allowed. 



Syntax of USER_ID Function :

USER_ID ( [ 'user' ] )

user is a username. It is of type nchar. It is an optional. If you don't specify the current user is assumed. 

Return type of USER_ID is a smallint.




Examples of USER_ID Function :

Example 1 : Use of USER_ID function in select clause 

SELECT USER_ID ('
NorthwindUser
')

Output
6

Above example returns NorthwindUser user's database id number.
  
Share: 

 
 
 

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

Sarita Patel
Sarita Patel author of USER_ID 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!