I have got a fieldname called suspenseDate.
This fieldname is usually given a value of 20 days.
This means that if an event occurs today, I have a suspensedate of 20 days to exercise an option.
An email program has been developed to send a reminder to the individual responsible for exercising this option. The email is supposed to go out 3 days before the 20-day deadline elapses, reminding him that he has 3 days left before the 20-day deadline for exercising an option is over.
Is there anything wrong with this code?
So far, no email has been sent even though there are instances where email should have been sent.
SELECT ID, fieldContactName, CONVERT(VarChar,SuspenseDate,101),CONVERT(VarChar,EntryDate,101)
WHERE CONVERT(VarChar,DateAdd(day,-17,getdate()),101) = CONVERT(VarChar,SuspenseDate,101)
AND receiptDate IS NULL AND Department = 'IT'
ORDER BY [Activity].ID DESC