SQL Server Articles

Submit Article
Home » Articles » SQL Server » Security FunctionsRSS Feeds


Posted By: Sarita Patel     Category: SQL Server     Views: 3793

This article explains about SUSER_SNAME function in sql server with examples.

SUSER_SNAME returns login identification name from a user's security identification number (SID).

SUSER_SNAME can be used as a DEFAULT constraint in either ALTER TABLE or CREATE TABLE.

Syntax of SUSER_SNAME Function :

SUSER_SNAME ( [ 'server_user_sid' ] )

server_user_sid is a user's security identification number. It is of type varbinary(85). It is an optional. If you don't specify then it returns information about current user. 

Return type of SUSER_SNAME is a nvarchar(256).

Examples of SUSER_SNAME Function :

Example 1 : Use of SUSER_SNAME function in select clause 

SELECT SUSER_SNAME (0x0105000000000005150000007D3F02A2B97927CFBCECB55FE8030000)


Above example returns login name for specified user's security identification number.


Didn't find what you were looking for? Find more on SUSER_SNAME Function Or get search suggestion and latest updates.

Sarita Patel
Sarita Patel author of SUSER_SNAME Function is from United States.
View All Articles

Related Articles and Code:

Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

No Comment Found, Be the First to post comment!