check database role

like IS_SRVROLEMEMBER helped to verify a server role, is there an equivalent for database role?

thanks
LVL 6
anushahannaAsked:
Who is Participating?
 
BrandonGalderisiConnect With a Mentor Commented:
Is USERNAME a user in the SQL database?
Is SRBSV\jimw a user in the SQL database?
Is tracker_DEV_users a user in the database?

This script will show you the full mapping in each DB.

SELECT su.name,sr.name, is_rolemember(sr.name,su.name) 'is_RoleMember'
FROM sysusers su
  CROSS JOIN sysusers sr
WHERE su.islogin=1
  AND sr.issqlrole=1
0
 
BrandonGalderisiCommented:

SELECT is_rolemember('ROLENAME','USERNAME')


ex.
SELECT is_rolemember('db_owner','USERNAME')
0
 
anushahannaAuthor Commented:
Brandon

is my format any issue..

all of these are returning NULLs

use tracker
SELECT is_rolemember('db_owner','USERNAME') -- your example
SELECT is_rolemember('db_owner','SRBSV\jimw') -- Domain User Group
SELECT is_rolemember('db_owner','tracker_Dev_Users') --SQL Login
0
 
anushahannaAuthor Commented:
got it.

thanks Brandon.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.