Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Update trigger

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-05-06 : 15:00:40
Richard writes "I am trying to create an update trigger. One table "Students" has a list of students taking classes. Another table is the master "Course" table that is a listing of all classes and max. students allowed to take that class. When an INSERT is done on the "Students" table I want the trigger to count how many students are listed in that class and update the "Course" table with that new total of students or just update the value of enrolled_Students in the Course table by a value of 1.

Student table
student_ID | course_ID | student_Name |

Course table
course_ID | course_Name | course_Date | max_Students |enrolled_Students

enrolled_Students need to be updated by 1 everytime and Insert is done into the Student Table."
   

- Advertisement -