How to automatically generate a reminder email to the User on the 14th calendar day in Sql Server 2008?

Hi
I have a webpage through with NewsFeedback is submitted.
In the table, I have feedbackdate_submitted, feedbackdate_closed, userid, useremail,  information in the database.

I need to send a reminder email automatically on the 14th calendar day after the first time feedback is submitted. If feedback submitted on May1, then reminder email will generate on May14 to the user.  After then every 10th day, email reminder wil send to user as long as the feedback is not closed.

How to do that in sql server job?

Thanks
Saroj13Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Leo TorresSQL DeveloperCommented:
You may need to enable procedure use in sql.

look Here
https://msdn.microsoft.com/en-us/library/ms190307.aspx

Create a job that calls dbo.sp_send_dbmail
pass it parameters needed
0
Scott PletcherSenior DBACommented:
You'll have to add a "feedback_reminder_count" to that table (or put it in a different table), because you have to know the first feedback reminder vs. later than the first.  I'll assume that column's in the same table.

IF OBJECT_ID('tempdb.dbo.#reminders') IS NOT NULL
    DROP TABLE dbo.#reminders
--query to determine reminders that need sent today
SELECT t.feedbackdate_submitted, t.userid, t.useremail
INTO dbo.#reminders
FROM tablename t
WHERE
    t.feedback_closed IS NULL AND
    ((t.feedback_reminder_count = 1 AND t.feedbackdate_submitted = DATEADD(DAY, -14, GETDATE())) OR
     ((DATEDIFF(DAY, t.feedbackdate_submitted, GETDATE()) - 14) % 10 = 0))

--...<<code to email the reminders goes here>>...

UPDATE t
SET feedback_reminder_count = feedback_reminder_count + 1
FROM tablename t
INNER JOIN dbo.#reminders r ON
    r.userid = t.userid AND
    r.useremail = t.useremail
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.