Technical Article

Find Users in a Database

,

This script would help you find users, their logins, roles etc in a database.

select 
left(rtrim(case u1.islogin when 1 then u1.name end), 30) 'Login Name', 
left(rtrim(u1.name), 30) 'User Name', 
left(rtrim(u2.name), 30) 'Group Name' 
from sysusers u1, sysusers u2 
where u1.gid = u2.uid and 
u1.sid is not null and 
u1.name not in ('guest', 'dbo', 'Administrator')

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating