Create an application to do the required job. And the create a schedule to run the application at required interval.
For example lets consider the scenario you mentioned above. Create an application which interacts with the database and gets the reminder time and formatted mail content. If the reminder time is less than equal to 2 days, send the mail and mark a flag in the database saying the reminder mail has been sent for this record.
Now
create a schedule[
^] to this this application everyday. You can decrease the time, depending on how close you want the mail to be sent based on time saved in database.
Also if you have a scenario where just SQL scripts can do the work, you can create
SQL Jobs[
^] to do the work for you.
Hope this helps!