UFN_CONSTITUENTPROFILE_MAILPREFERENCE_CONTACTS
Builds a contacts string for the mail preferences section of the constituent profile report
Return
Return Type |
---|
nvarchar(max) |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN |
Definition
Copy
create function dbo.UFN_CONSTITUENTPROFILE_MAILPREFERENCE_CONTACTS
(
@ID as uniqueidentifier
)
returns nvarchar(max)
with execute as caller
as begin
declare @CONTACTS nvarchar(max);
select
@CONTACTS = COALESCE(@CONTACTS + ', ', '') + case when MAILPREFERENCEORGCONTACTTYPE.USEPRIMARYCONTACT = 1 then 'Primary contact' else CONTACTTYPECODE.DESCRIPTION end
from
dbo.MAILPREFERENCEORGCONTACTTYPE
left join
dbo.CONTACTTYPECODE on CONTACTTYPECODE.ID = MAILPREFERENCEORGCONTACTTYPE.CONTACTTYPECODEID
where
MAILPREFERENCEORGCONTACTTYPE.MAILPREFERENCEID = @ID;
return @CONTACTS;
end