Link to home
Start Free TrialLog in
Avatar of Lia Nungaray
Lia NungarayFlag for United States of America

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...
Avatar of vdr1620
vdr1620
Flag of United States of America image

Try this..
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
Try using MAX() instead of COUNT()
ASKER CERTIFIED SOLUTION
Avatar of man2002ua
man2002ua

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Lia Nungaray

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!
Worked like a charm! Thanks! Sorry for the delay in closing this question...