Export (0) Print
Expand All
ABS
ALL
AND
ANY
AVG
bit
COS
COT
DAY
EXP
GO
IN
LEN
LOG
MAX
MIN
NOT
OR
PI
SET
SIN
STR
SUM
TAN
USE
VAR
Expand Minimize

SUSER_NAME

SQL Server 2000

Returns the user's login identification name.

Important  SUSER_NAME always returns NULL when used in Microsoft® SQL Server™ 2000. This system built-in function is included only for backward compatibility. 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

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft