I have a task to automatically bill all registered patients in PatientsInfo
table an Annual Bill of N2,500 base on the DateCreated
column.
Certainly I will use a stored procedure to insert these records into the PatientDebit
table and create a SQL Job to perform this procedure.
How will I select *
patients in PatientsInfo
table where DateCreated
is now 1 yr old for me to insert into another table PatientDebit
.
I have my algorithm like this:
- select date of registration for patients from
PatientsInfo
table - Add 1 year to their
DateCreated
- Is date added today? if yes,
- Insert record into
PatientDebit
table with the bill of N2,500 - If no, do nothing.
Please how do I write the script?