I have two columns eff_date and end_date, for which I have two input variables in SQL in_eff_dt and in_end_dt. I need to check their ranges don't overlap. For r1 the eff_dt and end_dt are 10/02/2022 and 23/02/2022 and for r2 it is 14/02/2022 and 01/03/2022 so their range is overlapping. I need to validate this while inputting the value in the table Main_table in UPSERT procedure.
Any suggestions will be appreciated.