mercredi 27 janvier 2016

How to iterate through table for an sql job?

PerformanceReview

  • prID
  • reviewDate
  • passed
  • notes
  • successStrategy
  • empID
  • nextReviewDate

above is my table I am working with, my goal is to get the nextReviewDate check to see if it is within 7 days of the current date ( I will do this using DATEDIFF() ) and send an email to a specified email address if this condition is true.

My question is, how do I make it so that my sql job will perform this task for each performance review row in the table. I have researched and found information on CURSORS, or using WHILE loops being slow and inefficient for this task. Any help is appreciated as I am in the final stage of development :)

Aucun commentaire:

Enregistrer un commentaire