USP_EDUCATIONALHISTORY_DELETE_PROMPT

Provides the prompt for the "Educational History: Delete" record operation.

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN Represents information to be displayed in the record operation prompt.
@PROMPT nvarchar(200) INOUT

Definition

Copy


                            CREATE procedure dbo.USP_EDUCATIONALHISTORY_DELETE_PROMPT
                            (
                                @ID uniqueidentifier,
                                @PROMPT nvarchar(200) output
                            )
                            as
                            set nocount on;

                            set @PROMPT = 'Are you sure you want to delete this educational history?';

                                        declare @EDUCATIONALINSTITUTIONID uniqueidentifier
                            declare @CONSTITUENTID uniqueidentifier

                            select  @CONSTITUENTID = CONSTITUENTID,
                                    @EDUCATIONALINSTITUTIONID = EDUCATIONALINSTITUTIONID
                            from dbo.EDUCATIONALHISTORY where ID = @ID

                            --If the record deleted is the only reference to an educationalinstitution used in an involvement, update the involvements educationalinstitution field to null

                            if (select count(EDUCATIONALINSTITUTIONID) from dbo.EDUCATIONALHISTORY 
                                where CONSTITUENTID = @CONSTITUENTID 
                                and   EDUCATIONALINSTITUTIONID = @EDUCATIONALINSTITUTIONID) = 1 and exists (select ID from dbo.EDUCATIONALINVOLVEMENT where CONSTITUENTID = @CONSTITUENTID and EDUCATIONALINSTITUTIONID = @EDUCATIONALINSTITUTIONID)
                            begin
                                set @PROMPT = 'There is related involvement information for this institution.  The institution will be removed from those records.  Are you sure you want to delete this institution?'
                            end