UFN_EDUCATIONALHISTORY_GETCURRENTSTATUSHISTORYID

Returns the latest EducationalHistoryStatusHistoryID for a given EducationalHistory record.

Return

Return Type
uniqueidentifier

Parameters

Parameter Parameter Type Mode Description
@EducationalHistoryID uniqueidentifier IN

Definition

Copy


        create function dbo.UFN_EDUCATIONALHISTORY_GETCURRENTSTATUSHISTORYID(
            @EducationalHistoryID uniqueidentifier
        )
        returns uniqueidentifier
        with execute as caller
        as begin
            declare @EducationalHistoryStatusHistoryID uniqueidentifier

            select top 1
                @EducationalHistoryStatusHistoryID = dbo.EDUCATIONALHISTORYSTATUSHISTORY.[ID]
            from
                dbo.EDUCATIONALHISTORYSTATUSHISTORY
            inner join dbo.EDUCATIONALHISTORYSTATUS on dbo.EDUCATIONALHISTORYSTATUSHISTORY.[EDUCATIONALHISTORYSTATUSID] = dbo.EDUCATIONALHISTORYSTATUS.[ID]
            where dbo.EDUCATIONALHISTORYSTATUSHISTORY.[EDUCATIONALHISTORYID] = @EducationalHistoryID
            order by dbo.EDUCATIONALHISTORYSTATUSHISTORY.[DATECHANGED] desc

            return @EducationalHistoryStatusHistoryID
        end