0

I have an SQL table that represents the material currently committed to a job. Whenever a job is completed the data is removed, as we only want long-term records of the final material used.

The problem is that we now want to get the Job Number and Material Number for each committed material over the past week (including those that have cleared when the job was completed) as an email message. We'd rather not create a new table or send emails daily.

Is there anyway to get Database Mail (through a SQL Server Agent Job or something else) to gather the information on a day-by-day basis (probably more than once a day) but only send one email at the end of the week?

Justin Burgard
  • 440
  • 1
  • 6
  • 17
  • Not sure about Database Mail. But why you dont use Server Agent to save the data in a new table and then send the email at the end of week with all the data in that table? Clean the table and repeat. – Juan Carlos Oropeza Sep 18 '15 at 17:44
  • 1
    You would have to store the daily information somewhere persistent. A table or a flat-file are the only options I can think of. – Tab Alleman Sep 18 '15 at 19:00
  • I did not know I could do this in Server Agent. Do you know where a guide to this is? (90% of my work has been flat SQL code, I don't know SQL Server very well). – Justin Burgard Sep 25 '15 at 15:31

0 Answers0