Listing the users in the database

The stored procedure sp_helpuser takes an optional parameter—a user name. It returns details about the user and the group to which the user belongs. It also shows the user’s login name (in case it’s different from the user name) and identifies the user’s default database, as shown in this example:

sp_helpuser

UserName GroupName LoginName DefDBName UserID SUserID 
-------- --------- --------- --------- ------ ------- 
ColinT   Users     ColinT    Accounts  3      14      
dbo      Admin     sa        master    1      1       
DuncanG  Admin     DuncanG   Accounts  4      11      
GlennM   Users     GlennM    Accounts  5      15      
guest    (null)    (null)    (null)    2      -1      
SallyG   Users     SallyG    Accounts  6      12      

sp_helpuser ColinT

UserName GroupName LoginName DefDBName UserID SUserID 
-------- --------- --------- --------- ------ ------- 
ColinT   Users     ColinT    Accounts  3      14