UFN_SPROPPCHILD_BIRTHDATE_ISREQUIRED
Require a birthdate on a child sponsorship opportunity record if the sponsorship program has age range filled in
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | |
@BIRTHDATE | UDT_FUZZYDATE | IN |
Definition
Copy
create function dbo.UFN_SPROPPCHILD_BIRTHDATE_ISREQUIRED
(
@ID uniqueidentifier,
@BIRTHDATE udt_fuzzydate
)
returns bit
with execute as caller
as begin
declare @AGERANGEID uniqueidentifier;
select
@AGERANGEID = SG.SPONSORSHIPOPPORTUNITYAGERANGEID
from
SPONSORSHIPOPPORTUNITY SO
inner join SPONSORSHIPOPPORTUNITYGROUP SG on SO.SPONSORSHIPOPPORTUNITYGROUPID = SG.ID
where
SO.ID = @ID;
/* age range is null on program or both child birthdate and age range is filled in on program. */
if @AGERANGEID is null or (@BIRTHDATE <> '00000000' and @AGERANGEID is not null)
return 1;
return 0;
end