DEBUG DEBUG DEBUG...
What happens when you execute that query from SQL Server management console (or QA if you are still using SQL Server 2000)??
This is PURELY a guess. But I think it might be because you are indeed doing
If there are *NO* eventmsg instances found, then you are essentially asking it to do
and I am just *guessing* that a COUNT(null) is itself null, so you get no records.
I'll bet you could fix this easily, if I'm right. Just do:
SELECT ISNULL( count(distinct EventMSG), 0 ) as Total_Events