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
Post a Comment