Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

Send email in a tabular format using SQL Server database mail conditionally depending upon result row count

$
0
0
Hi Experts..


Requirement:
--If the
following query resulted greater than zero rows, send email in a tabular format
using SQL Server database mail
--if is is equal to zero ,don't send the
mail.

can someone help me in this




SELECT
[DateTime]
,[Text]

FROM [MicrosoftLog].[dbo].[Log]


where
[LogApplicationID] in (select [LogApplicationID]
from
[MicrosoftLog].[dbo].[LogApplication]
where applicationname in
(
'VirtualMan',
'PhysicalMan')) and StartText<> 'count=0'
and
StartDateTime < GetDate() and StartDateTime > dateadd(minute, -30,
GetDate())




Any input is appreciated

Viewing all articles
Browse latest Browse all 8428

Trending Articles



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