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.
Author |
Topic |
poser
Posting Yak Master
124 Posts |
Posted - 2006-09-20 : 19:03:09
|
Hello all,I have questions and need help with the writing triggers.I have two tablesReservationsGuest TableID Menu1 5 42 6 33 7 24 5 3TablesTableID Seats Max1 2 52 4 53 2 54 5 105 2 56 3 57 7 108 2 4anytime the Reservations.Tableid is deleted\Inserted\Updated I want to reflect this in the tables column.So if guest 1 changed to tableid 7 It would reflect in Tables TableID 7 Seats would increase to 8and Table TableID 5 would decrease to 1Results would look like this:ReservationsGuest TableID Menu1 7 42 6 33 7 24 5 3TablesTableID Seats Max1 2 52 4 53 2 54 5 105 1 56 3 57 8 108 2 4would a trigger work best for this?Maybe I'm getting too complicated for me.Thanks for your help.r/P |
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2006-09-20 : 19:22:00
|
Nope - a better design will help you better here.Your 'Tables' table should not have the 'Seats' column. This is dynamic and should be derived from the 'Reservations' table. |
 |
|
|
|
|