Lia Nungaray
asked on
How to set MSSQL result to text
I have a few queries that count the amount of documents that are run, and it also displays the amount of seconds since the last document was processed. What I would like to do, is when there are no more documents to process, instead of displaying a 0, I would like to display a text indicating that there are no more pending documents. Here's what I have:
COUNT(CASE WHEN success IS NULL AND processed_dts IS NULL THEN 'No documents to process' END)
If I take out the COUNT, I will get an error because I am not using an aggregate function.
Thanks...
COUNT(CASE WHEN success IS NULL AND processed_dts IS NULL THEN 'No documents to process' END)
If I take out the COUNT, I will get an error because I am not using an aggregate function.
Thanks...
Try using MAX() instead of COUNT()
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for all your comments experts, I was on vacation the last two weeks, I'm currently trying out man2002ua suggestion, will continue updating this question... Thanks!
ASKER
Worked like a charm! Thanks! Sorry for the delay in closing this question...
CASE WHEN COUNT(success) IS NULL AND COUNT(processed_dts) IS NULL THEN 'No documents to process' END
I would be better to post your complete code with some sample data