USP_TIMETABLEDAY_DELETEPERIODS

Executes the "Delete timetable day periods" record operation.

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN Input parameter indicating the ID of the record being deleted.
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the delete.

Definition

Copy


                        --we are not deleting the day...just the associated periods

                        CREATE procedure dbo.USP_TIMETABLEDAY_DELETEPERIODS
                        (
                            @ID uniqueidentifier,
                            @CHANGEAGENTID uniqueidentifier
                        )
                        as begin
                            --check deletion rules, if any


                            declare @contextCache varbinary(128);

                            /* cache current context information */
                            set @contextCache = CONTEXT_INFO();

                            /* set CONTEXT_INFO to @CHANGEAGENTID */
                            if not @CHANGEAGENTID is null
                                set CONTEXT_INFO @CHANGEAGENTID

                            delete from dbo.PATTERNBLOCKMEETING where TIMETABLEDAYID = @ID

                            --remove empty pattern blocks

                            exec dbo.USP_PATTERNBLOCK_UNUSED_DELETE @CHANGEAGENTID

                            delete from dbo.TIMETABLEDAYPERIOD where TIMETABLEDAYID = @ID

                            /* reset CONTEXT_INFO to previous value */
                            if not @contextCache is null
                                set CONTEXT_INFO @contextCache

                            -- use the system generated delete routine to allow proper recording of the deleting agent

                            --exec USP_TIMETABLEDAY_DELETEBYID_WITHCHANGEAGENTID @ID, @CHANGEAGENTID

                            return 0;

                        end