UFN_SPONSORSHIPOPPORTUNITY_TRANSLATIONFUNCTION_FIRSTNAMEONLY

Return

Return Type
nvarchar(50)

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN

Definition

Copy


create function dbo.UFN_SPONSORSHIPOPPORTUNITY_TRANSLATIONFUNCTION_FIRSTNAMEONLY(@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 = CONSTITUENT.FIRSTNAME
    from SPONSORSHIPOPPORTUNITYCHILD
    inner join dbo.CONSTITUENT on CONSTITUENT.ID = SPONSORSHIPOPPORTUNITYCHILD.ID
    where SPONSORSHIPOPPORTUNITYCHILD.ID=@ID;
  end
  else
  begin
    select @s = NAME from SPONSORSHIPOPPORTUNITYPROJECT where ID=@ID
  end
    return @s;
end