user_id

Description

Returns the ID number of the specified user or of the current user in the database.

Syntax

user_id([user_name])

Parameters

user_name

is the name of the user.

Examples

Example 1

select user_id()

------ 
    1 

Example 2

select user_id("margaret")

------
    4 

Usage

Standards

SQL92 – Compliance level: Transact-SQL extension.

Permissions

You must System Administrator or System Security Officer to use this function on a user_name other than your own.

See also

Commands setuser

Functions suser_id, user_name