SQL SERVER counter via query

I suggest that at least once  see the sys.dm_os_performance_counters view. For an example execute this simple query:

SELECT cntr_value
     FROM sys.dm_os_performance_counters
        WHERE object_name = 'mssql$gf2008:general statistics'
          AND counter_name = 'logins/sec'
Advertisements