Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Run stored procedure in a trigger (I think)

Posted on 2008-06-18
5
824 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
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…

856 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