asp.net - How to compare Starting time and End time of a event with existing events of same time on same day? -
i using ms sql server 2008. here need compare newly entered start time , end time of event existing event timings. in database need check new starting time , end time values , time period should not match existing/ booked event timings.
i need check condition in database stored procedure, if condition satisfied accept event. best example conference hall booking.
select @count = count (eventid) tblevent (('@starttime' between starttime , endtime) or ('@endtime' between starttime , endtime)); if @count = 0 begin select @count = count (eventid) tblevent (('@starttime' < starttime , '@endtime' > endtime)); end if @count > 0 begin select 'event exists @ point of time please select time ' 'message'; end else begin //add query save the event in db// select 'event added' 'message'; end note:
@starttime = user entered start time,
@endtime =user entered end time
Comments
Post a Comment