USP_BBNC_PRIMARYBUSINESSPHONES

Retrieves the phones of a constituent's primary business for Blackbaud Internet Solutions.

Parameters

Parameter Parameter Type Mode Description
@ID int IN

Definition

Copy


            CREATE procedure dbo.USP_BBNC_PRIMARYBUSINESSPHONES(@ID int)
            as
                set nocount on;

                select
                    PHONETYPECODE.DESCRIPTION as PHONETYPE,
                    PHONE.NUMBER
                from
                    dbo.CONSTITUENT
                inner join
                    dbo.PHONE on CONSTITUENT.ID = PHONE.CONSTITUENTID -- Pull the phone from the constituent, not their business.

                left join
                    dbo.PHONETYPECODE on PHONE.PHONETYPECODEID = PHONETYPECODE.ID
                where
                    CONSTITUENT.SEQUENCEID = @ID
                order by
                    PHONE.ISPRIMARY desc, PHONE.SEQUENCE;
                --Order matters since Galileo allows multiple phones with the same type and BBNC only uses the first