I want to compare an inserted date against two stored dates in order to validate an entry. The date entered is being stored in a separate table from the stored dates.
I am not sure how to go about this. So far I have this:
create PROCEDURE sp_GetTime @FullName varchar(50), @ConsultantId numeric, @App_Date datetime output AS SELECT * FROM vwPatientConsultantAvailability vw inner Join Appointments app on vw.ConsultantId = app.ConsultantId where @FullName=FullName and @ConsultantId=ConsultantId and @App_Date=App_Date if @App_Date < vw.AvailableStart
I realise I can add if statements to the procedure so if @App_Date between DateA and DateB then validate. if there is a better method please let me know.