without more details, all i can offer is an example:
in this case, I've wrapped the counting sql with another query to get me the isnull of the count.
SELECT ISNULL(CNT,0) As MatchingRecords FROM
(SELECT
COUNT(*) AS CNT
FROM SYSOBJECTS
WHERE 1=2 --CONDITION WILL NEVER FIND RECORDS
) X
the other thing to do is to use a SUM and CASE to calculate the count:
SELECT
SUM(CASE WHEN xtype IN ('U') THEN 1 ELSE 0 END) AS TableCount,
SUM(CASE WHEN xtype IN ('V') THEN 1 ELSE 0 END) AS ViewCount,
SUM(CASE WHEN xtype IN ('P') THEN 1 ELSE 0 END) AS ProcCount,
SUM(CASE WHEN xtype IN ('FN','TF') THEN 1 ELSE 0 END) AS FuncCount,
SUM(CASE WHEN xtype IN ('bananas') THEN 1 ELSE 0 END) AS WierdCount --CONDITION WILL NEVER FIND RECORDS
FROM SYSOBJECTS
Lowell