SQListic
SSCertifiable
Points: 6904
More actions
August 14, 2013 at 11:44 am
#278604
Hi Experts,
How can i setup send a mail when a condition is not satisfied.
Select count(* ) from table
where conditions x,y,z
if count(*) is < 1
send mail.
Thanks in advance
homebrew01
SSC Guru
Points: 55454
August 14, 2013 at 12:10 pm
#1641520
Declare @RecCount int
set @RecCount = (Select count(* ) from table
where conditions x,y,z)
if @RecCount > 0 begin
EXEC msdb.dbo.sp_send_dbmail
end
August 14, 2013 at 3:42 pm
#1641593
Thank you! it helped me
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply