UFN_CONSTITUENT_ISBOARDMEMBER
This functions returns whether a constituent is a board member as of the given date.
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@CONSTITUENTID | uniqueidentifier | IN |
Definition
Copy
CREATE function dbo.UFN_CONSTITUENT_ISBOARDMEMBER(@CONSTITUENTID uniqueidentifier)
returns bit
with execute as caller
as begin
declare @CURRENTDATE date;
set @CURRENTDATE = getdate();
if exists(
select
ID
from
dbo.BOARDMEMBERDATERANGE
where
BOARDMEMBERDATERANGE.CONSTITUENTID = @CONSTITUENTID and
(BOARDMEMBERDATERANGE.DATEFROM <= @CURRENTDATE or BOARDMEMBERDATERANGE.DATEFROM is null) and
(BOARDMEMBERDATERANGE.DATETO >= @CURRENTDATE or BOARDMEMBERDATERANGE.DATETO is null)
) return 1;
return 0;
end