UFN_PDACCOUNTSTRUCTURE_ACCOUNTSTRINGLENGTH2

Returns the number of characters in the account string

Return

Return Type
int

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN

Definition

Copy


CREATE function dbo.UFN_PDACCOUNTSTRUCTURE_ACCOUNTSTRINGLENGTH2(@ID uniqueidentifier)
returns int
with execute as caller
as 
begin
    declare @AcctStringLength int

  select @AcctStringLength = sum(LENGTH)+sum(case SEPARATORCODE when 6 then 0 else 1 end)-(select top 1 case SEPARATORCODE when 6 then 0 else 1 end from dbo.PDACCOUNTSTRUCTURE where PDACCOUNTSYSTEMID = @ID order by SEQUENCE desc) from dbo.PDACCOUNTSTRUCTURE where PDACCOUNTSYSTEMID=@ID
    return @AcctStringLength
end