SQL Server Articles

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


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

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

SESSION_USER function allows a system-supplied value for the current session's username to be inserted into a table when no default value is specified. Also allows the username to be used in queries, error messages etc.

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

Syntax of SESSION_USER Function :


Return type of SESSION_USER function is a nchar.

Examples of SESSION_USER Function :

Example 1 : Use of SESSION_USER function in select clause 



Above example returns current session's user name.


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

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