Logo 
Search:

SQL Server Articles

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

USER Function

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

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

USER allows a system-supplied value for the current user's database username to be inserted into a table when no default value is specified.

USER provides the same functionality as the USER_NAME system function.

Use USER with DEFAULT constraints in either the CREATE TABLE or ALTER TABLE statements, or use as any standard function.



Syntax of USER Function :

USER

Return type of USER is a char.




Examples of USER Function :

Example 1 : Use of USER function in select clause 

SELECT USER

Output
dbo

Above example returns current user's database username.
  
Share: 

 
 
 

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

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