Reports information about Microsoft® SQL Server™ users, Microsoft Windows NT® users, and database roles in the current database.
sp_helpuser [[@name_in_db =] 'security_account']
0 (success) or 1 (failure)
Neither a user account nor a SQL Server or Windows NT user is specified for security_account.
Column name | Data type | Description |
---|---|---|
UserName | sysname | Users and Windows NT users in the current database |
GroupName | sysname | Roles to which UserName belongs |
LoginName | sysname | Login of UserName |
DefDBName | sysname | Default database of UserName |
UserID | smallint | ID of UserName in the current database |
SuserID | smallint | Server user ID |
No user account is specified and aliases exist in the current database.
Column name | Data type | Description |
---|---|---|
LoginName | sysname | Logins aliased to users in the current database |
UserNameAliasedTo | sysname | Username in the current database that the login is aliased to |
A role is specified for security_account.
Column name | Data type | Description |
---|---|---|
Group_name | sysname | Name of the role in the current database |
Group_id | smallint | Role ID for the role in the current database |
Users_in_group | sysname | Member of the role in the current database |
Userid | smallint | User ID for the member of the role |
Use sp_helpsrvrole and sp_helpsrvrolemember to return information about fixed server roles.
Executing sp_helpuser for a database role is equivalent to executing sp_helpgroup for that database role.
Execute permissions default to the public role.
This example lists all users in the current database.
EXEC sp_helpuser
This example lists information about the user dbo.
EXEC sp_helpuser 'dbo'
This example lists information about the db_securityadmin fixed database role.
EXEC sp_helpuser 'db_securityadmin'
sp_adduser | sp_helpsrvrole |
sp_dropuser | sp_helpsrvrolemember |
sp_helpgroup | System Stored Procedures |
sp_helprole |