I'll be scheduling a SQL server code to output a HTML into an email daily, sometimes this table might have no rows. I still want the code to run and send the email but saying "No Data" or something along those lines.
Is this possible? If so could someone show some example code? I'm assuming I'll need to change the From bit of the code, i.e.
CAST(( select td =col1,'', td=col2,''
from #TempTable1
Order by 1
For XML PATH ('tr'),TYPE
) AS NVARCHAR(MAX) ) +
etc....
So to clarify: My question is how do I do a "conditional" from statement, i.e. if #TempTable1 has data then enter #TempTable1 if not then say "No Data".
Thanks @SeanLange for pointing out my questions wasn't clear.