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

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -