代码改变世界

【SQLServer】列出所有login账号

  abce  阅读(104)  评论(0编辑  收藏  举报

Get the list of all Login Accounts in a SQL Server

1
2
3
4
5
SELECT name AS Login_Name, type_desc AS Account_Type
FROM sys.server_principals
WHERE TYPE IN ('U', 'S', 'G')
and name not like '%##%'
ORDER BY name, type_desc

 

Get the list of all SQL Login Accounts only

1
2
3
4
SELECT name
FROM sys.server_principals
WHERE TYPE = 'S'
and name not like '%##%'

 


Get the list of all Windows Login Accounts only

1
2
3
SELECT name
FROM sys.server_principals
WHERE TYPE = 'U'


Get the list of all Windows Group Login Accounts only

1
2
3
SELECT name
FROM sys.server_principals
WHERE TYPE = 'G'

 

相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2016-03-03 Oracle RAC inventory.xml损坏后如何修复
2016-03-03 python中的三引号
点击右上角即可分享
微信分享提示