检查SQL Server中的安全组中的用户 [英] Check users in a security group in SQL Server
问题描述
在数据库的Security/Users文件夹中,我有一堆安全组,包括"MyApplication Users".我需要检查我是否属于该组(或另一个用户),但是我不知道如何查询它或在哪里可以看到此信息.我尝试在属性中查找,但找不到任何内容.有什么想法吗?
In the Security/Users folder in my database, I have a bunch of security groups, include "MyApplication Users". I need to check if I am (or another user is) in this group, but I have no idea how to query for it or where I could see this information. I tried looking in the properties, but couldn't find anything. Any ideas?
推荐答案
检查您自己或当前用户:
Checking yourself or the current user:
SELECT IS_MEMBER('[group or role]')
结果1 =是,0 =否,并且null =查询的组或角色无效.
A result of 1 = yes,0 = no, and null = the group or role queried is not valid.
要获取用户列表,请尝试xp_logininfo(如果启用了扩展proc,并且相关组是Windows组):
To get a list of the users, try xp_logininfo if extended procs are enabled and the group in question is a windows group :
EXEC master..xp_logininfo
@acctname = '[group]',
@option = 'members'
这篇关于检查SQL Server中的安全组中的用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!