-
Stored Procedures
I am working on a student database for a project and I want the range of modules assigned to a particular cohort to be automatically inserted into the relevant tables once the cohort has been allocated to each student. I am trying to create a procedure which will insert this specific data to the relevant table once the administrator identifies the correct cohort for the student. The data in question i.e.the modules are pre-determined. The data is inserted to the relevant table using the Primary Key= student ID.It From researching the task it looks like a stored procedure is the way to go. Any suggestions as to how the syntax should be created would be much appreciated.
-
A stored procedure would be a good approach if you have several scripts/systems that all need to trigger the same action. In most cases it is unnecessary - but that doesn't mean you shouldn't do it that way if you decide it would be best. Keep in mind that most web hosts require you to buy a VPS before they allow stored procedures.
Something else that occurs to me from reading your question is that, if the data is all "pre-determined," why not simply set that data as the default values for your table?
Have you studied how stored procedures are written? What code do you have so far?