UFN_SOLICITCODE_CONSENTENABLED
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@CONSENTTYPE | int | IN |
Definition
Copy
CREATE function dbo.UFN_SOLICITCODE_CONSENTENABLED(@CONSENTTYPE int)
returns bit
with execute as caller
as begin
/*
Input is the enum int defined for consent on the solicit code table
0 = none, 1 = EU, 2 = Advanced
*/
declare @CONSENTCOUNT int = 0; -- default the false result
if (@CONSENTTYPE <> 0)
begin
-- one record is good enough for this consent to be on
select top 1 @CONSENTCOUNT = count(*)
from dbo.SOLICITCODE
where CONSENTCODE = @CONSENTTYPE;
end
else
begin
-- if a 0 is passed in it is not on as that is not a consent type
select @CONSENTCOUNT = @CONSENTTYPE;
end
return(CAST(@CONSENTCOUNT as bit));
end;