Returns the login identification number of the user.
SUSER_ID always returned NULL when used in SQL Server 2000. Starting with SQL Server 2005, SUSER_ID returns the value listed as principal_id in the sys.server_principals catalog view.
SUSER_ID ( [ 'login' ] )
Is the login name of the user. login is nchar. If login is specified as char, login is implicitly converted to nchar. login can be any SQL Server login or Windows user or group that has permission to connect to an instance of SQL Server. If login is not specified, the login identification number for the current user is returned. If login contains the word NULL will return NULL.
SUSER_ID returns an identification number only for logins that have been explicitly provisioned inside SQL Server. This ID is used within SQL Server to track ownership and permissions. This ID is not equivalent to the SID of the login that is returned by SUSER_SID. If login is a SQL Server login, the SID maps to a GUID. If login is a Windows login or Windows group, the SID maps to a Windows security identifier.
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.
In SQL Server version 7.0, the security identification number (SID) replaced the server user identification number (SUID).
The following example returns the login identification number for the sa login.