Solved! Go to Solution.
That's a boatload of error text but all it's really doing is summing up six stats from a SQL table. You can run it manually by copying everything from "SELECT" through "exchangeserverID=2" into a new query in SQL Management Studio. (I hope you have a copy-paste-friendly version of the error in some log somewhere.)
The problem is that one of these six sums is returning NULL, while the EMA expects it to have a value and doesn't account for the possibility that it might be NULL. When the EMA assumes the result will contain a numeric value and it does not, this conversion error occurs.
This needs to be fixed by the author of the EMA by testing that each SQL result is not equal to DBNull before assigning it to a variable of type Long. See example here.
While you wait for that to happen, you could probably circumvent the problem by making sure that none of the SUM functions results in NULL. That is, if the column returning NULL is AttachmentCount, send a message with an attachment to at least one mailbox.
Thanks Chris - I'm getting some guidance that it's indicative of permission problem with the proxy user but so far I'm not seeing an error to confirm that. The EMA manual page 5 says
"If permissions are not set up correctly, the user will be notified and EMA will terminate"
but that isn't what I am seeing happen.
I'm verifying with customer that the emaproxy account isn't locked/expired/something like that, but puzzled that if that were the case, why EMA wouldn't complain about it directly. I'll post here when I know more.