:::: MENU ::::

Get current connection context through SUSER_SNAME

  • Nov 06 / 2012
  • 0
dbDigger, Logins and Users, Monitoring and Analysis, Security and Permissions

Get current connection context through SUSER_SNAME

If you are required to get the current connection context then SUSER_SNAME() function may be used. Primarily it is meant to return the user when security identification number (SID) is passed as parameter. However without passing parameter it would return the current connection context in terms of user. This information may be more helpful when used along with impersonation. Here is a simple example to use the SUSER_SNAME.

SELECT SUSER_SNAME() 
GO
Consult us to explore the Databases. Contact us