UFN_PDACCOUNTCODEMAPFOREIGNCURRENCY_NAMESTRING

Returns a comma delimited string of payment method types that correspond to the bitmap field @Mask.

Return

Return Type
nvarchar(max)

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN

Definition

Copy


create function dbo.UFN_PDACCOUNTCODEMAPFOREIGNCURRENCY_NAMESTRING(
    @ID uniqueidentifier
    )
returns nvarchar(max)
with execute as caller
as begin
declare @SUBTYPEID uniqueidentifier
declare @retString nvarchar(max)
select  @SUBTYPEID = max(SUBTYPEID) from dbo.PDACCOUNTCODEMAPPINGSUBTYPE where PDACCOUNTCODEMAPPINGID = @ID and ADDITIONALSUBTYPE = 9

if @SUBTYPEID = '99999999-9999-9999-9999-999999999999'
    select  @retString =  'All currencies'
else 
    select @retString = isnull(@retString+', ','') + NAME
    from  dbo.CURRENCY 
    join dbo.PDACCOUNTCODEMAPPINGSUBTYPE  on PDACCOUNTCODEMAPPINGSUBTYPE.SUBTYPEID = CURRENCY.ID
    where PDACCOUNTCODEMAPPINGSUBTYPE.PDACCOUNTCODEMAPPINGID = @ID


return @retString
end