Applies To: SQL Server 2014, SQL Server 2016 Preview
Returns the login identification number of the user.
Starting with SQL Server 2005, SUSER_ID returns the value listed as principal_id in the sys.server_principals catalog view.
Applies to: SQL Server (SQL Server 2008 through current version).
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 the parameter 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.
The following example returns the login identification number for the sa login.