UFN_OPPORTUNITY_GETLONGDESCRIPTION
Returns a detailed description of an opportunity.
Return
Return Type |
---|
nvarchar(500) |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN |
Definition
Copy
CREATE function dbo.UFN_OPPORTUNITY_GETLONGDESCRIPTION
(
@ID uniqueidentifier
)
returns nvarchar(500)
with execute as caller
as
begin
declare @DESCRIPTION nvarchar(500);
select
@DESCRIPTION = case when OPPORTUNITY.ASKDATE is null
then NF.NAME + ': ' + convert(NVARCHAR(36), OPPORTUNITY.ASKAMOUNT, 1) + ' (' + OPPORTUNITY.STATUS + ')'
else NF.NAME + ': ' + convert(NVARCHAR(36), OPPORTUNITY.ASKAMOUNT, 1) + ' (' + OPPORTUNITY.STATUS + ') - ' + coalesce(convert(NVARCHAR(10), OPPORTUNITY.ASKDATE, 101), '')
end
from
dbo.OPPORTUNITY
left outer join
dbo.PROSPECTPLAN on OPPORTUNITY.PROSPECTPLANID = PROSPECTPLAN.ID
outer apply dbo.UFN_CONSTITUENT_DISPLAYNAME(PROSPECTPLAN.PROSPECTID) NF
where
OPPORTUNITY.ID = @ID;
return @DESCRIPTION;
end