SYSTEM_USER
SYSTEM_USER is a built-in function in SQL. It returns the name of the current user within the context of the SQL Server. The return type is nvarchar, and the function does not require any parameters.
SYSTEM_USER()
Example
SELECT SYSTEM_USER AS 'CurrentUser';
Output
CurrentUser-----------sa
Explanation
The SYSTEM_USER function in the provided SQL Server query returns the current system user name. In this example, the system user is ‘sa’.
SYSTEM_USER()
Example
SELECT SYSTEM_USER FROM dual;
Output
'OracleUser'
Explanation
The SYSTEM_USER function returns the current Oracle user name. In this case, ‘OracleUser’ is returned as it is the name of the current user.