USER_ID (T-SQL)

Returns a user’s database identification number.

Syntax

USER_ID(['user'])

Arguments
'user'
Is the username to be used. user is nchar. If a char value is specified, it is implicitly converted to nchar.
Return Types

int

Remarks

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.

Examples

This example returns the identification number for user Harold.

SELECT USER_ID('Harold')

  

See Also

Security Functions

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.