Function SESSION_USER in SQL Server
The SESSION_USER statement returns the username of the current session in the SQL Server database.
This article will show you in detail how to use SESSION_USER function in SQL Server with specific syntax and examples to better visualize and capture functions.
Describe
The SESSION_USER statement returns the username of the current session in the SQL Server database.
Syntax
To use the SESSION_USER statement in SQL Server, we use the following syntax:
SESSION_USER
- There are no parameters and arguments in the statement.
Note :
- Do not put parentheses () after the SESSION_USER function.
- See also CURRENT_USER, USER_NAME and SYSTEM_USER functions.
- SESSION_USER can be used in later versions of SQL Server: SQL Server 2017, SQL Server 2016, SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, and SQL Server 2005.
For example
See how to use the SESSION_USER statement in SQL Server.
SELECT SESSION_USER;
Result: 'quantrimang'
Previous article: NULLIF function in SQL Server
Next lesson: SESSIONPROPERTY function in SQL Server
You've just finished reading the article "Function SESSION_USER in SQL Server" edited by the TipsMake team. You can save function-session_user-in-sql-server.pdf to your computer here to read later or print it out. We hope this article has provided you with many useful tech tips and tricks. You can search for similar articles on tips and guides. Thank you for reading and for following us regularly.
- MAX function in SQL Server
- FUNCTION (Function) in SQL Server
- SUM function in SQL Server
- AVG function in SQL Server
- ABS function in SQL Server
- DATEPART function in SQL Server
- DATENAME function in SQL Server
- ROUND function in SQL Server
- CEILING function in SQL Server
- RIGHT function in SQL Server
- FLOOR function in SQL Server
- MONTH function in SQL Server
- DATEDIFF function in SQL Server
- GETUTCDATE function in SQL Server