Alert query not working based on expiry date
I want to set up an alert for a UDF fields in my Sales Order Title based on the date which is put. The field is expiry date and I want that before 7 days of expiry date Alert should pop up. I am using the below query but No Alert is coming which is already set in Alert Management
I also want that 2 alerts should come which is before 7 days and before 15 days of expiry date.
declare @datevar datetime select @datevar = getdate() SELECT T0.[DocNum], T0.[DocDate], T0.[CardCode], T0.[CardName], T0.[DocTotal], T0.[U_LCVal], T0.[U_LCSDate], T0.[U_LCEdate] FROM ORDR T0 WHERE DATEDIFF(DD, T0.U_LCEdate, @datevar) > 7
Please guide what might be wrong.