Sorry, my original version uses many functions in my Util database, I thought replaced them all with the source code version. GetCPUUsage is an inline table valued function and needs to return single row back to the select statement, you can replace it with the select section of the query below by replacing @TOP with 1.