Replace GET DIAGNOSTICS on a SELECT query with just SELECT COUNT().