CURRENT_USER statement in SQL Server

The CURRENT_USER statement returns the name of the current user in the SQL Server database.

This article will show you in detail how to use the function to handle CURRENT_USER statements in SQL Server with specific syntax and examples to better visualize and capture functions.

Describe

The CURRENT_USER statement returns the name of the current user in the SQL Server database.

Syntax

To use the CURRENT_USER statement in SQL Server, we use the following syntax:

 CURRENT_USER 
  1. There are no parameters and arguments in the statement.

Note :

  1. Do not put parentheses () after CURRENT_USER function.
  2. See also USER_NAME, SESSION_USER and SYSTEM_USER functions.
  3. CURRENT_USER can be used in later versions of SQL Server: SQL Server 2017, SQL Server 2016, SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, and SQL Server 2005.

For example

See how to use the CURRENT_USER statement in SQL Server.

 SELECT CURRENT_USER; 
Result: 'quantrimang'

Previous article: COALESCE command in SQL Server

Next lesson: ISDATE function in SQL Server

4.5 ★ | 2 Vote