DATABASE_PRINCIPAL_ID

Returns the ID number of a principal in the current database.

Syntax

DATABASE_PRINCIPAL_ID ( 'principal_name' )

Arguments

'principal_name'

Is an expression of type sysname that represents the principal.

When principal_name is omitted, the ID of the current user is returned. The parentheses are required.

Return types

int

Example

SELECT DATABASE_PRINCIPAL_ID('random_principal_name') ;

See Also