UFN_CONSTITUENT_ISFORMERSPONSOR
This functions returns whether a constituent had a sponsor constituency in the past.
Return
| Return Type |
|---|
| bit |
Parameters
| Parameter | Parameter Type | Mode | Description |
|---|---|---|---|
| @CONSTITUENTID | uniqueidentifier | IN |
Definition
Copy
CREATE function dbo.UFN_CONSTITUENT_ISFORMERSPONSOR(@CONSTITUENTID uniqueidentifier)
returns bit
with execute as caller
as begin
declare @CURRENTDATE date;
set @CURRENTDATE = getdate();
if exists(
select
ID
from
dbo.SPONSORDATERANGE
where
SPONSORDATERANGE.CONSTITUENTID = @CONSTITUENTID and
(SPONSORDATERANGE.DATETO <= @CURRENTDATE)
) return 1;
return 0;
end