Monthly Archives: February 2022

Query machine and instance information

Query SQL server machine information

-- machine  info
select
    SERVERPROPERTY('MachineName') AS ComputerName,
    SERVERPROPERTY('ServerName') AS InstanceName,  
    CPUCount                = cast(cpu_count as varchar(300)),
    HyperThreadRatio        = cast(hyperthread_ratio as varchar(300)),
    SocketCount             = cast(socket_count as varchar(300)),
    CoresPerSocket          = cast(cores_per_socket as varchar(300)),
    PhysicalMemoryGB        = cast((physical_memory_kb / 1048576) as varchar(300)),
    IsClustered             = SERVERPROPERTY('IsClustered'),
    SERVERPROPERTY('IsHadrEnabled') IsAlwaysOn
from sys.dm_os_sys_info