SUSER_NAME (TSQL Function)

Returns the name of the login with the specified ID.

Syntax

SUSER_NAME ( [login_id] ) 

Arguments

login_id
optional argument, of type bigint. If omitted, the name of the current login is returned.

Return Types

Returns varchar.

Remarks

Returns NULL if the login doesn’t exist.

The functions SYSTEM_USER and SUSER_NAME() return the same result.

Examples

PRINT SYSTEM_USER;
PRINT SUSER_NAME();
PRINT SUSER_NAME(1034);

The result is:

sa
sa
jack