UFN_OPPORTUNITYDESIGNATION_ISUNIQUE
Checks if Opportunity Designations are unique
Return
Return Type |
---|
int |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@OPPORTUNITYID | uniqueidentifier | IN | |
@DESIGNATIONID | uniqueidentifier | IN | |
@CONSTITUENTID | uniqueidentifier | IN |
Definition
Copy
create function dbo.UFN_OPPORTUNITYDESIGNATION_ISUNIQUE
(
@OPPORTUNITYID uniqueidentifier,
@DESIGNATIONID uniqueidentifier,
@CONSTITUENTID uniqueidentifier
)
returns integer
with execute as caller
as begin
declare @return integer
declare @count integer
set @return = 1
if @DESIGNATIONID is not null
begin
select @count=count(*) from OPPORTUNITYDESIGNATION
where OPPORTUNITYID = @OPPORTUNITYID
and DESIGNATIONID = @DESIGNATIONID
and coalesce(CONSTITUENTID, '00000000-0000-0000-0000-000000000000') = coalesce(@CONSTITUENTID, '00000000-0000-0000-0000-000000000000')
if @count > 1
set @return = 0 ;
end
return @return ;
end