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.
0
 
PatHartmanCommented:
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.
0
 
awking00Commented:
What does your query look like?
0
 
Fernando SotoRetiredCommented:
Can you please post the code you are using to retrieve the data.
0
 
Abdul KhanAuthor Commented:
Thank you.
0
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.