SUSER_ID
Returns the user's login identification number.
Important SUSER_ID always returns NULL when used in Microsoft® SQL Server™ 2000. This system built-in function is included only for backward compatibility. Use SUSER_SID instead.
Syntax
SUSER_ID ( [ 'login' ] )
Arguments
'login'
Is the user's login identification name. login, which is optional, is nchar. If login is specified as char, it is implicitly converted to nchar. login can be any SQL Server login or Microsoft Windows NT® user or group that has permission to connect to SQL Server. If login is not specified, the login identification number for the current user is returned.
Return Types
int
Remarks
In SQL Server 7.0, the security identification number (SID) replaces the server user identification number (SUID).
SUSER_SID returns a SUID 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 login identification number for the sa login.
SELECT SUSER_ID('sa')