This script returns all logins that are members of the sysadmin fixed server role. It includes login type, whether the login is disabled, and default database information.
This is commonly used during security reviews, onboarding and offboarding checks, and when validating privileged access in production environments.
The Script
Example Output
The result set shows one row per login that belongs to the sysadmin role.
Key columns include:
- login_name – The name of the login
- login_type – SQL login, Windows login, or Windows group
- is_disabled – Indicates whether the login is currently disabled
- default_database_name – Default database assigned to the login
This provides a quick view of privileged access on the instance.

Notes
- Features should be enabled intentionally, not by default
- These are instance-level configuration settings
- Changes may require
RECONFIGUREto take effect - CLR strict security is recommended when CLR is enabled
Leave a Reply