SQL Tutorial SQL Advanced SQL Database SQL References

SQL Server CURRENT_USER Function



The SQL Server (Transact-SQL) CURRENT_USER function returns the name of the current user in the SQL Server database. This function is equivalent to calling USER_NAME() function without specifying the identification number.

Syntax

CURRENT_USER

Parameters

No parameter is required.

Return Value

Returns the name of the current user in the SQL Server database.

Example:

The example below shows the usage of CURRENT_USER function.

SELECT CURRENT_USER;

The above query will return the name of current user in the SQL Server database. Therefore if the SQL Server account that was used was 'za108909', it will return the following:

SELECT CURRENT_USER;
Result: 'za108909'

❮ SQL Server Functions