UFN_SPONSORSHIPOPPORTUNITY_TRANSLATIONFUNCTION
Return
Return Type |
---|
nvarchar(50) |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN |
Definition
Copy
CREATE function dbo.UFN_SPONSORSHIPOPPORTUNITY_TRANSLATIONFUNCTION(@ID uniqueidentifier) returns nvarchar(50)
as
begin
declare @s nvarchar(50);
declare @sc uniqueidentifier;
declare @st int;
select @st = SPONSORSHIPOPPORTUNITYGROUP.SPONSORSHIPOPPORTUNITYTYPECODE
from dbo.SPONSORSHIPOPPORTUNITY
inner join dbo.SPONSORSHIPOPPORTUNITYGROUP on SPONSORSHIPOPPORTUNITYGROUP.ID = SPONSORSHIPOPPORTUNITY.SPONSORSHIPOPPORTUNITYGROUPID
where SPONSORSHIPOPPORTUNITY.ID = @ID;
if @st=1
begin
select @s = NF.NAME
from SPONSORSHIPOPPORTUNITYCHILD
outer apply dbo.UFN_CONSTITUENT_DISPLAYNAME(SPONSORSHIPOPPORTUNITYCHILD.CONSTITUENTID) NF
where SPONSORSHIPOPPORTUNITYCHILD.ID=@ID
end
else
begin
select @s = NAME from SPONSORSHIPOPPORTUNITYPROJECT where ID=@ID
end
return @s;
end