CURRENT_USER statement in SQL Server

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

Table of Contents

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

You've just finished reading the article "CURRENT_USER statement in SQL Server" edited by the TipsMake team. You can save current_user-statement-in-sql-server.pdf to your computer here to read later or print it out. We hope this article has provided you with many useful tech tips and tricks. You can search for similar articles on tips and guides. Thank you for reading and for following us regularly.

« PREV ISDATE function in SQL Server
NEXT » COALESCE statement in SQL Server