SUSER_ID (TSQL Function)

Returns the ID of the specified login.

Syntax

SUSER_ID ( ['login_name'] ) 

Arguments

login_name
optional argument, of type varchar. If omitted, the ID of the current login is returned.

Return Types

Returns bigint.

Remarks

Returns NULL if the login doesn’t exist.

Examples

DECLARE @lg VARCHAR(30) = 'sa';
DECLARE @a  BIGINT;

SET @a = SUSER_ID(@lg);
PRINT @a;
PRINT SUSER_NAME(@a);

The result is:

1000
sa
RSQL, a simple alternative to Microsoft SQL Server