Solved

Run stored procedure in a trigger (I think)

Posted on 2008-06-18
5
819 Views
Last Modified: 2009-07-29
I have a table which hold records that represent invitations to answer questions in a survey. When the record is created it creates an email and sends it out using ASP. The recepient has 14 days to complete the survey then the invite no longer works. In the record is a column for date created.

What I want is a reminder email to be sent out after 7 days, then with 3 days left, and then 1 day left. I am assuming I would do this with a trigger and the stored procedure "msdb.dbo.sp_send_dbmail". Can anybody get me started in the right direction. Is a trigger the right direction? I might need some serious hand holding on this.
0
Comment
Question by:phishyman2
  • 3
  • 2
5 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 21816244
You can schedule a jon to do this, thats the best thing ..
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 21816246
I meant, a sql Job
0
 

Author Comment

by:phishyman2
ID: 21816381
OK.

I am assuming that during the creation of this job for the first step I would set it up as Transact-SQL script. Could you give me started on what I would put in the command box, based on the situation I listed above.
0
 

Author Comment

by:phishyman2
ID: 21816570
I understand that I want to call my stored procedure like this:

EXEC msdb.dbo.sp_send_dbmail @recipients='mak_999@yahoo.com',
    @subject = 'My Mail Test',
    @body = 'This is my mail test',
    @body_format = 'HTML' ;

But I only want to effect records returned by this query:

select * from franr.riskassessment
where date_created + 7 = getdate()

How do I combine them together?
0
 

Accepted Solution

by:
phishyman2 earned 0 total points
ID: 22521654
This issue has been resolved by another outside source that was beyond my control.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now