Returns the server user’s ID number from the syslogins table.
suser_id([server_user_name])
select suser_id()
------ 1
select suser_id("margaret")
------ 5
suser_id, a system function, returns the server user’s ID number from syslogins. For general information about system functions, see Transact-SQL Users Guide.
To find the user’s ID in a specific database from the sysusers table, use the user_id system function.
If no server_user_name is supplied, suser_id returns the server ID of the current user.
See also Transact-SQL Users Guide.
ANSI SQL – Compliance level: Transact-SQL extension.
Any user can execute suser_id.