I have a somewhat complex select, which is supposed to return appointments that need notified bewteen today and the appointment date. Sounds simple, but, the appointments have a notification date...which depends on how many days in advance the client wants notified. On top of that, holidays and weekends add to the days in advance.
Everything seemed to be working fine this month, Christmas gave no problems, now we are around a new year and I'm having problems.....
Appointment set for 1/2/2004 where the client wants notified 1 day in advance, which happens to be 1/1/2004 which is a holiday...so the date moves to 12/31/2003 which is today.
My WHERE
.......
AND
(CONVERT(varchar(25), GETDATE(), 101)
BETWEEN
CONVERT(varchar(25), dbo.fn_Confirm_Date(dbo.v_
Appointmen
ts_Active.
Appointmen
t_Log_id,
dbo.Client_Confirmation_Co
nfiguratio
n.confirm_
days_in_ad
vance), 101)
AND
CONVERT(varchar(25), dbo.v_Appointments_Active.
Appointmen
t_Date_Tim
e, 101))
Which I see as being:
Is 12/31/2003 Between 12/31/2003 and 1/2/2004
Anyone have any ideas why the new year seems to give me a problem?
Start Free Trial