Skip to main content
6 events
when toggle format what by license comment
Sep 6, 2017 at 6:49 vote accept TheSwede86
Sep 5, 2017 at 20:37 comment added Solomon Rutzky @TheSwede86 If the code you posted in the exact code you are using (minus changing the "..." into [...]), then that is simply due to you creating a variable, @alerttriggered, setting it to a value, and then checking it via: IF (@alerttriggered IS NOT NULL). That means your IF condition is effectively if (true). If you want the variable to indicate any rows returned, change the variable to be INT and then do: SELECT @alerttriggered = COUNT(*) FROM... and then the rest of that query, but not in single quotes. Then check using: IF (@alerttriggered > 0) ....
Sep 5, 2017 at 20:03 comment added RDFozz @TheSwede86 - You may want to ask this as a new question, as the problem is different. You can post the code (working as it does now) without allowing confusion from the previous issue. Feel free to include a link to this question if it seems relevant. You may at least want to note that this is a follow-up (so if parts of the question seem like something people have seen before, they'll understand why).
Sep 5, 2017 at 11:08 comment added TheSwede86 Thank you so much for your reply and help! Did what you suggested and it works now! However I want the email to be sent only if the query returns (any) values but now it always sends the email with the body: "0 rows affected". I think that my code now looks correct but I really don't know anymore shakes head Please see my paste / code: link
Sep 4, 2017 at 22:13 history edited Solomon Rutzky CC BY-SA 3.0
added details
Sep 4, 2017 at 21:59 history answered Solomon Rutzky CC BY-SA 3.0