SUSER_NAME (T-SQL)

Returns the user’s login identification name. The SUSER_NAME system function is included in Microsoft® SQL Server™ version 7.0 for backward compatibility only. Use SUSER_SNAME instead.

Syntax

SUSER_NAME([server_user_id])

Arguments
server_user_id
Is the user’s login identification number. server_user_id, which is optional, is int. server_user_id can be the login identification number of any SQL Server login or Microsoft Windows NT® user or group that has permission to connect to SQL Server. If server_user_id is not specified, the login identification name for the current user is returned.
Return Types

nchar

Remarks

In SQL Server 7.0, the security identification number (SID) replaces the server user identification number (SUID).

SUSER_NAME returns a login name only for a login that has an entry in the syslogins system table.

System functions can be used in the select list, in the WHERE clause, and anywhere an expression is allowed, and must always be followed by parentheses (even if no parameter is specified).

Examples

This example returns the user’s login identification name for a login identification number of 1.

SELECT SUSER_NAME(1)

  

See Also
Managing Security System Functions

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.