SQL 2008...
declare @a as bigint, @b-2 as bigint
select @a=sum(cntr_value)
from sys.dm_os_performance_counters
where object_name = 'SQLServer:Resource Pool Stats' and cntr_type = 537003264
select distinct @b-2=cntr_value
from sys.dm_os_performance_counters
where...