Returns a user’s database identification number.
USER_ID(['user'])
int
When user is omitted, the current user is assumed. Parentheses are required.
USER_ID can be used in the select list, in the WHERE clause, and anywhere an expression is allowed. For more information, see Expressions.
This example returns the identification number for user Harold.
SELECT USER_ID('Harold')