I have a task to automatically invoice all registered patients in the table PatientsInfoas an annual bill in the amount of 2500 manat in a column DateCreated.
Of course, I will use the stored procedure to insert these records into the table PatientDebitand create an SQL job to complete this procedure.
How will I be select *patients in the table PatientsInfo, where DateCreatednow 1 year for me to insert into another table PatientDebit.
I have my algorithm:
- select the registration date for patients from the table
PatientsInfo - Add 1 year to their
DateCreated - Is date added today? If yes,
- Insert an entry into the table
PatientDebitwith account N2,500 - If not, do nothing.
How do I write a script?
source
share