Can a SQL trigger do this?
Hi, I'm new to the whole SQL thing and have been reading about triggers in my SQL books. Hopefully a trigger can do the following but I have no idea on how to properly write it.
I have two tables Employee and TimeOff. (1 to many relation) They are related to each other with a field(column) named EmpID in both tables.
Whenever the value of the field named VacTaken in the TimeOff table changes I would like to update the field VacUsed in the Employee Table with the sum/total of all the VacTaken entries in the TimeOff table.
If this can be done, would someone be kind enough to post a sample of the code that could do this.
Thanks
David Shaw
Hi, I'm new to the whole SQL thing and have been reading about triggers in my SQL books. Hopefully a trigger can do the following but I have no idea on how to properly write it.
I have two tables Employee and TimeOff. (1 to many relation) They are related to each other with a field(column) named EmpID in both tables.
Whenever the value of the field named VacTaken in the TimeOff table changes I would like to update the field VacUsed in the Employee Table with the sum/total of all the VacTaken entries in the TimeOff table.
If this can be done, would someone be kind enough to post a sample of the code that could do this.
Thanks
David Shaw