Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29929

Write and Empty Temp Table into a HTML table in SQL Server

$
0
0

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.


Viewing all articles
Browse latest Browse all 29929


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>