UFN_PROSPECTID_MAPFROM_OPPORTUNITYID

Maps a OPPORTUNITYID to a PROSPECTID

Return

Return Type
uniqueidentifier

Parameters

Parameter Parameter Type Mode Description
@OPPORTUNITYID uniqueidentifier IN

Definition

Copy


            create function dbo.UFN_PROSPECTID_MAPFROM_OPPORTUNITYID(@OPPORTUNITYID uniqueidentifier) 
            returns uniqueidentifier
            as
            begin
                declare @ID uniqueidentifier;

                select
                    @ID = PROSPECTPLAN.PROSPECTID
                from
                    dbo.PROSPECTPLAN
                inner join
                    dbo.OPPORTUNITY on OPPORTUNITY.PROSPECTPLANID = PROSPECTPLAN.ID
                where
                    OPPORTUNITY.ID = @OPPORTUNITYID;

                return @ID;
            end