Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当前使用 Active Directory 组对用户进行身份验证。我想知道的是 A 组是否有 100 个用户。我如何知道哪些用户在当前时间专门登录。据我了解,SQL 将显示组信息而不是确切的用户。
T-SQL 函数 SUSER_SNAME() 将返回连接到 SQL Server 的用户的域\登录名。但这就是您可以开箱即用的“用户信息”的范围。
编辑:您可以使用exec sp_who2which 返回带有domain\user的结果集。
exec sp_who2