Add a data line when the SQL SP creates a blank file

I use a SP to extract a CSV file daily, once in a while I get a blank file when there is no matching query; how do I add a line that simply says "No data today"  and add it to my file when there is a blank file so my user can see the message..
Abdul KhanAsked:
Who is Participating?
Arifhusen AnsariBusiness Intelligence Developer and AnalystCommented:
You can add your final query data in temp table .And before exporting data just check. If temp table has data export it if not insert data with message no data found  in first column.

Hope it will help you.
Count the selected rows.  If the count is >0, export the query.  If the count is 0, export a single record with the message in it.
What does your query look like?
Fernando SotoRetiredCommented:
Can you please post the code you are using to retrieve the data.
Abdul KhanAuthor Commented:
Thank you.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.