Saturday, 25 May 2019

List out SQL Server details



SELECT SERVERPROPERTY ('MachineName') AS MachineName,@@SERVICENAME AS InstanceName,
            SERVERPROPERTY ('Edition') AS Edition,
            SERVERPROPERTY('Collation') AS Collation,
            SERVERPROPERTY ('INSTANCEDEFAULTDATAPATH')   AS DefaultDataPath,
             SERVERPROPERTY ('INSTANCEDEFAULTLOGPATH') AS DefaultLogPath,
            SERVERPROPERTY ('PRODUCTVERSION') AS ProductVersion,
             SERVERPROPERTY ('BUILDCLRVERSION') AS BuildCLRVersion,
            SERVERPROPERTY ('PROCESSID') AS ProcessID,
             SERVERPROPERTY ('ResourceLastUpdateDateTime') AS ResourceLastUpdateDateTime,
   CASE When ServerProperty('EngineEdition')=1 Then 'Desktop'
When ServerProperty('EngineEdition')=2 Then 'Standard'
When ServerProperty('EngineEdition')=3 Then 'Enterprise'
When ServerProperty('EngineEdition')=4 Then 'Express'
When ServerProperty('EngineEdition')=5 Then 'SQL Azure'
             Else 'Unknown'
END AS EngineEdition,
   CASE When ServerProperty('IsClustered') =0 Then  'Non-Clustered'
             When ServerProperty('IsClustered') =1 Then  'Clustered'
              Else 'Unknown'
   END AS ClusterType,ServerProperty('ProductLevel') AS ProductLevel

No comments:

Post a Comment