In this post explains how to use the SYSTEM_USER function in SQL Server (Transact-SQL) with syntax and examples.
In SQL Server (Transact-SQL), the SYSTEM_USER function returns the login name information for the current user in the SQL Server database.
The syntax for the SYSTEM_USER function in SQL Server (Transact-SQL) is:
SYSTEM_USER
There are no parameters or arguments for the SYSTEM_USER function.
The SYSTEM_USER function can be used in the following versions of SQL Server (Transact-SQL):
Let's look at some SQL Server SYSTEM_USER function examples and explore how to use the SYSTEM_USER function in SQL Server (Transact-SQL).
For example:
SELECT SYSTEM_USER;
Output: 'test_domain\jsmith' (logged in using Windows Authentication)
SELECT SYSTEM_USER;
Output: 'jsmith' (logged in using SQL Server Authentication)