撈取所有SQL上面的帳號清單

在SSMS執行以下指令
select sp.name as login,
       sp.type_desc as login_type,
       sl.password_hash,
       sp.create_date,
       sp.modify_date,
       case when sp.is_disabled = 1 then 'Disabled'
            else 'Enabled' end as status
from sys.server_principals sp
left join sys.sql_logins sl
          on sp.principal_id = sl.principal_id
where sp.type not in ('G', 'R')
order by sp.name;

以下是範例

 

資料庫: XXX

Login帳號名稱

Login Type

建立日期

上次使用日期

用途

保管人

啟用中

##MS_PolicySigningCertificate##

CERTIFICATE_MAPPED_LOGIN

2019-09-24 14:21:16.393

2019-09-24 14:21:16.393

 

 

關閉

##MS_PolicyTsqlExecutionLogin##

SQL_LOGIN

2019-09-24 14:21:53.570

2021-04-01 05:35:28.367

 

 

啟用

##MS_SmoExtendedSigningCertificate##

CERTIFICATE_MAPPED_LOGIN

2019-09-24 14:21:16.393

2019-09-24 14:21:16.393

 

 

啟用

##MS_SQLAuthenticatorCertificate##

CERTIFICATE_MAPPED_LOGIN

2019-09-24 14:21:16.390

2019-09-24 14:21:16.390

 

 

啟用

##MS_SQLReplicationSigningCertificate##

CERTIFICATE_MAPPED_LOGIN

2019-09-24 14:21:16.390

2019-09-24 14:21:16.390

 

 

啟用

##MS_SQLResourceSigningCertificate##

CERTIFICATE_MAPPED_LOGIN

2019-09-24 14:21:16.390

2019-09-24 14:21:16.390

 

 

啟用

NT AUTHORITY\SYSTEM

WINDOWS_LOGIN

2021-04-01 05:35:27.673

2021-04-01 05:35:27.680

 

 

啟用

footer See also :

留言

這個網誌中的熱門文章

Office 2021 離線安裝封裝與KMS啟動步驟

Ollama使用心得與模型導入教學

ARC下NSMutableDictionary 無法使用retainCount