This SQL Server tutorial explains how to use the CURRENT_USER function in SQL Server (Transact-SQL) with syntax and examples.
Description
In SQL Server (Transact-SQL), the CURRENT_USER functions returns the name of the current user in the SQL Server database.
Syntax
The syntax for the CURRENT_USER function in SQL Servers (Transact-SQL) is:
CURRENT_USER
Parameters or Arguments
There are no parameters or arguments for the CURRENT_USER function.
Note
- Do not put parentheses () after the CURRENT_USER function.
- See also the USER_NAME, SESSION_USER, and SYSTEM_USER functions.
Applies To
The CURRENT_USER function can be used in the following versions of SQL Servers (Transact-SQL):
- SQL Server 2017, SQL Server 2016, SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, SQL Server 2005
Example
Let’s look at some SQL Server CURRENT_USER functions examples and explore how to use the CURRENT_USER function in SQL Servers (Transact-SQL).
For example:
SELECT CURRENT_USER; Result: 'dbo'
Pingback: SQL Server: SYSTEM_USER Function - Adglob Infosystem Pvt Ltd