有两个管理帐户(服务器管理员和 Active Directory 管理员)充当管理员。我的要求是找出这些帐户的名称。我查看了 sys.database_principles 视图和 sys.sql_logins 视图,但找不到与此相关的任何内容。从SQL查询我找不到任何有用的系统视图来获取信息。有人可以帮我吗?
答案 0 :(得分:1)
您可以使用下面的TSQL脚本获取服务器管理和 Active Directory管理帐户名称。
SELECT [name], [type], [type_desc], [authentication_type], [authentication_type_desc] FROM sys.database_principals
WHERE (type = 'S' AND [name] != 'dbo' AND authentication_type = 1) OR
(type = 'X' AND authentication_type = 4)
重要提示: