select - sp_send_dbmail sending mail even if condition is false - SQL -


मेरे पास एक संग्रहीत कार्यविधि का IF स्टेटमेंट हिस्सा निम्नानुसार है:

  अगर कोशिश करें तो EXISTS (SELECT जो मैंने पुष्टि की है कि रिटर्न कोई परिणाम नहीं है, इसमें एक अन्य कॉलम में से एक वेरिएबल कहलाता है जहां खंड में है) BEGIN EXEC msdb.dbo.sp_send_dbmail @profile_name = @dynamic_profile, @recipients = @dynamic_recipient, @subject = @subjectline, @body = @mailHTML, @body_format = 'HTML'; END END कोशिश   

यह एक नौकरी से जुड़ी है जो हर 15mins को चलाता है << p>

Div class = "post-text" itemprop = "text">

कोशिश करें - इसके बजाय:

  यदि (सेलेक्ट COUNT (*) जो भी हो) & gt; 0 BEGIN - MAIL END    

Comments

Popular posts from this blog

c# - The item with identity 'Id' already exists in the metadata collection. Parameter name: item -

sql - PostgreSQL automatically update row at specific date -

jsp - No mapping found for HTTP request with URI with annotation config Spring MVC and Jetty -