SQL Server trigger to conditionally update a column in the same table I am inserting or updating to -


new posting in forum have been lurking years. have trigger question seems above head in both innate knowledge , researching skills.

i have created appointment scheduler app pointed sql server 2008 database works way outlook works have come 1 impass needs solved. need create trigger update column on 1 or more rows of appointments table representing number of appointments exist @ same date , time when appointment added, updated or deleted.

so if add, update or delete appointment, trigger see how many appointments exist @ time , date of inserted/changed/deleted record , update records exist same time , date reflect new number of appointments remaining @ time slot. make sense? ideas?

thanks ton help!

why store appointmentsinslot when can query find how many , not have worry triggers:

select     [scheduletime],     [appointmentsinslot] = count(id) [dbo].[appointments] group [scheduletime] 

if needed add clause filter days want.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -