sql - sp_send_dbmail : send email if specific variable selected -
i having issue in sql have website should fire email if specific category selected. @ moment fire regardless of category selected.
 if @notescategory = 14       exec msdb.dbo.sp_send_dbmail       @profile_name = 'profilename',      @from_address = @notessenderemail,      @reply_to     = @notessenderemail,      @recipients   = @email,      @subject      = 'subject',      @body         = @mybody,      @body_format  = 'html',      @importance   = 'high'  end ...and reason fire regards of if notes category 14 or not.
any advice appreciated. many thanks.
you missed begin
if @notescategory = 14     begin          exec msdb.dbo.sp_send_dbmail           @profile_name = 'profilename',          @from_address = @notessenderemail,          @reply_to     = @notessenderemail,          @recipients   = @email,          @subject      = 'subject',          @body         = @mybody,          @body_format  = 'html',          @importance   = 'high'      end 
Comments
Post a Comment