Retrieve the username of the current user.
SELECT SESSION_USER; |
The SESSION_USER function retrieves the name of the current user within the SQL Server database.
SESSION_USER |
Works in: |
SQL Server (from 2008 onward), Azure SQL Database, Azure SQL Data Warehouse, and Parallel Data Warehouse |