Hi,
Was wondering if anyone had a sample stored procedure code that relates to what I'm trying to do.
I have a SQL table called MailQueue
with fields
MailQueue
- FromName
- FromAddress
- ToName
- ToAddress
- Subject
- Body
- HasSent
- DateStamp
What I'm trying to do is write a stored procedure that will send all email's with HasSent = 0 using sp_send_dbmail
Once the email goes out, I need to do an update Query that changes HasSent = 1
finally, one more SQL query that deletes all emails with hasSent = 1 that is older then 3 months.
If anyone has any code that's similar, I'd greatly appreciate it
Was wondering if anyone had a sample stored procedure code that relates to what I'm trying to do.
I have a SQL table called MailQueue
with fields
MailQueue
- FromName
- FromAddress
- ToName
- ToAddress
- Subject
- Body
- HasSent
- DateStamp
What I'm trying to do is write a stored procedure that will send all email's with HasSent = 0 using sp_send_dbmail
Once the email goes out, I need to do an update Query that changes HasSent = 1
finally, one more SQL query that deletes all emails with hasSent = 1 that is older then 3 months.
If anyone has any code that's similar, I'd greatly appreciate it
Comment