sp_helpuser System Stored Procedure

Reports information about the users of a database.

Syntax

sp_helpuser [username]

where

username
Is a user in the current database. If you don't specify a name, the system procedure reports on all users of the current database.

Remarks

If the specified user is not listed in the current database's sysusers table, the procedure checks to see if the user has an alias to another user or is a group name.

Examples

A.    List All Users

This example displays information about all users in the current database.

sp_helpuser
go
Users_name
ID_in_db
Group_name
Login_id
Default_db
-----------
--------
------------
----------
------------
ann
4
hackers
ann
master
dbo
1
public
sa
master
guest
2
public
NULL
NULL
judy
3
hackers
judy
master


B.    List Information for a Single User

This example displays information about the database owner.

sp_helpuser dbo

Permission

Execute permission defaults to the public group.

Tables Used

master.dbo.syslogins, sysalternates, sysusers

See Also

GRANT statement sp_help
REVOKE statement sp_helpgroup
sp_adduser USE statement
sp_dropuser