Simple Trigger SQL Server
Simple Trigger SQL Server
I'm new in SQL Server, and I have to make a trigger to help me to insert data in my table.
I have 2 simples tables, Test and Participant. (id + varchar each one).
Test are already inserted.
In a 3rd table, Inscription I would like to make an entry with each test each time I add a student in my student table
The 3rd table would be like : id | FK_idTest | FK_idStudent
I'm not familiar with sql language, i'm currently searching how to do this action, and I ask here too.
I'll come back if I find something by myself. I'll also take a look in the trigger section.
Students will be linked with all the tests. I was hoping i could use a for each to get all the tests then insert them in the 3rd table.
– Alban
Sep 11 '18 at 10:30
If the table will always have every student vs every test and no other fields then it doesn't seem like it serves a useful purpose... what do you intend to use this table for?
– Milney
Sep 11 '18 at 11:00
Triggers are a topic best addressed after you have mastered basic tsql.
– SMor
Sep 11 '18 at 12:15
0
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
No one here will write the code for you. You write the code, and if you run into problems, we will assist!
– jarlh
Sep 11 '18 at 10:24