SQL Server query to get the current user’s id, user name, system user, session user, current user, host name and server name

Using below query we will get the SQL Server user id, user name, system user, session user, current user, user and server name.

SQL Server Code:


select USER_ID() as [User Id],
USER_NAME() as [User Name], 
SYSTEM_USER as [System user], 
SESSION_USER as [Session user], 
CURRENT_USER as [current user], 
USER as [User], 
SUSER_SID() as [suser sid], 
HOST_NAME() as [Server Name]
Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

 
Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar