7developers blog

Useful articles, videos and code examples from professional developers

Get some hardware information via sql query on MS sql server

SELECT        cpu_count AS '# of Cores', hyperthread_ratio AS '# of Threads',
 cpu_count / hyperthread_ratio AS 'Physical CPU Count', 
                         physical_memory_in_bytes / 1048576 AS 'Physical memory (MB)'
FROM            sys.dm_os_sys_info
Result:

# of Cores   # of Threads   Physical CPU Count      Physical memory (MB)


4                      4                             1                                   8103




Loading