sql server中建了几个 "windows 组/ 域组" 的账号, 当一个通过windows认证的账户连接数据库时, 我们如何知道该用户是通过哪个“windows 组 / 域组”的权限登陆
数据库的呢?
summary: there is a user connect to database via windows authentication, and we can get it's corresponding "SQL Login Name / privilege" by this command: exec xp_logininfo 'domain\user'.
select system_user
--------------------------
domain1\whxu
(1 row(s) affected)
Exec xp_logininfo 'domain1\whxu'
account name type privilege mapped login name permission path
----------------- ----- --------- ------------------ ------------------------------------------------------------
domain1\whxu user admin domain1\whxu BUILTIN\Administrators
(1 row(s) affected)
红色标记的,才是
数据库库中创建的login_name, 这样我们就知道,这个用户是通过这个login的权限登陆进来的。