troubleshooting Question

SQL Stored Procedure to Send Email based on a field condition

Avatar of DJ P
DJ P asked on
DatabasesSQL
22 Comments1 Solution170 ViewsLast Modified:
Hello. I want to setup a trigger that sends an email based on a field condition in my sql database. The field in the databased is called UserDef5 and if the filed does not equal United States then send an email where the body of the email shows visitors firstname and last name (fieldname in table is FirstName, LastName) with the subject of the email to say: Potential Foreign National.

I already created a profile via the database mail configuration wizard called MonitorEmailProfile and did a successful email test.

What I don't know is how to setup the simple syntax of the stored procedure along with the logic of not sending a duplicate email multiple times if the record has already been read.

I would then setup an job to run every xx minutes to run. Hope that makes sense.
ASKER CERTIFIED SOLUTION
D B
Database Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 22 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 22 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros