Summary: Use the SERVERPROPERTY function in T-SQL to extract essential metadata about your SQL Server instance, including versioning, edition, patch levels, and feature support.
Discovering SQL Server Instance Details with SERVERPROPERTY
Ever needed to quickly grab essential information about your SQL Server instance? The SERVERPROPERTY function is a powerful tool for DBAs and developers alike. It allows you to retrieve a wide range of details—from network names and versioning to specific engine configurations like collation and default file paths—all without needing access to the physical host.
The Comprehensive Instance Audit Script
Below is a comprehensive SQL query that leverages SERVERPROPERTY to pull numerous valuable insights about your SQL Server environment into a readable vertical list.
-- Retrieve a detailed snapshot of SQL Server instance properties
SELECT SERVERPROPERTY('MachineName') AS [Value], 'Machine Name' AS [Description]
UNION ALL SELECT SERVERPROPERTY('ServerName'), 'Server Name'
UNION ALL SELECT SERVERPROPERTY('InstanceName'), 'Instance'
UNION ALL SELECT SERVERPROPERTY('IsClustered'), 'IsClustered'
UNION ALL SELECT SERVERPROPERTY('ComputerNamePhysicalNetBIOS'), 'NetBIOS Physical Name'
UNION ALL SELECT SERVERPROPERTY('Edition'), 'Edition'
UNION ALL SELECT SERVERPROPERTY('ProductLevel'), 'Product Level (RTM/SP/CU)'
UNION ALL SELECT SERVERPROPERTY('ProductUpdateLevel'), 'CU Level'
UNION ALL SELECT SERVERPROPERTY('ProductVersion'), 'Full Product Version'
UNION ALL SELECT SERVERPROPERTY('ProductMajorVersion'), 'Major Version'
UNION ALL SELECT SERVERPROPERTY('ProductMinorVersion'), 'Minor Version'
UNION ALL SELECT SERVERPROPERTY('ProductBuild'), 'Build Number'
UNION ALL SELECT SERVERPROPERTY('ProductBuildType'), 'Build Type (GDR/OD/CU)'
UNION ALL SELECT SERVERPROPERTY('ProductUpdateReference'), 'KB Article Reference'
UNION ALL SELECT SERVERPROPERTY('ProcessID'), 'OS Process ID'
UNION ALL SELECT SERVERPROPERTY('Collation'), 'Server Collation'
UNION ALL SELECT SERVERPROPERTY('IsFullTextInstalled'), 'Full-Text Search Installed'
UNION ALL SELECT SERVERPROPERTY('IsIntegratedSecurityOnly'), 'Windows Auth Only Mode'
UNION ALL SELECT SERVERPROPERTY('FilestreamConfiguredLevel'), 'Filestream Level'
UNION ALL SELECT SERVERPROPERTY('IsHadrEnabled'), 'Always On (HADR) Enabled'
UNION ALL SELECT SERVERPROPERTY('HadrManagerStatus'), 'HADR Manager Status'
UNION ALL SELECT SERVERPROPERTY('InstanceDefaultDataPath'), 'Default Data Path'
UNION ALL SELECT SERVERPROPERTY('InstanceDefaultLogPath'), 'Default Log Path'
UNION ALL SELECT SERVERPROPERTY('BuildClrVersion'), 'CLR Version'
UNION ALL SELECT SERVERPROPERTY('IsXTPSupported'), 'In-Memory OLTP Supported'
UNION ALL SELECT SERVERPROPERTY('IsPolybaseInstalled'), 'Polybase Installed'
UNION ALL SELECT SERVERPROPERTY('IsAdvancedAnalyticsInstalled'), 'Machine Learning / R Services'
OPTION (RECOMPILE);
Why Use This?
This query provides a detailed overview of your SQL Server setup, making it incredibly useful for:
- Inventory Audits: Quickly gathering version and edition details across multiple servers.
- Troubleshooting: Verifying if a specific Cumulative Update (CU) or KB patch has been applied.
- Configuration Checks: Ensuring default paths and security modes align with company standards.
Further Reading
For a complete and in-depth understanding of all properties available with this function, refer to the
official Microsoft documentation.
Need to automate your environment discovery? This script is a perfect starting point for building a dynamic server inventory dashboard!