user_id  valid_name

Chapter 2: Transact-SQL Functions

user_name

Description

Returns the name within the database of the specified user or of the current user.

Syntax

user_name([user_id]) 

Parameters

user_id

is the ID of a user.

Examples

Example 1

select user_name()
------------------------------ 
dbo 

Example 2

select user_name(4)
------------------------------
margaret

Usage

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

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

See also

Functions suser_name, user_id





Copyright © 2005. Sybase Inc. All rights reserved. valid_name

View this book as PDF