UFN_CATEGORYDEFINITION_ACCOUNTCODELENGTH
Checks category definition and account code segment are same length.
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@FromCode | varchar(30) | IN | |
@ToCode | varchar(30) | IN | |
@AccountSystemID | uniqueidentifier | IN |
Definition
Copy
CREATE function [dbo].[UFN_CATEGORYDEFINITION_ACCOUNTCODELENGTH](@FromCode varchar(30), @ToCode varchar(30), @AccountSystemID uniqueidentifier = null)
returns bit
with execute as caller
as begin
declare @retval bit = 1;
declare @SegLength int;
if @AccountSystemID is null
set @AccountSystemID = '4B121C2C-CCE6-440D-894C-EA0DEF80D50B';
select @SegLength = LENGTH from dbo.PDACCOUNTSTRUCTURE WHERE ELEMENTDEFINITIONCODE = 1 and PDACCOUNTSYSTEMID = @AccountSystemID and ISBASICGL=0
if len(@FromCode) > 0 or len(@ToCode) > 0
begin
if len(@FromCode) != @SegLength or len(@ToCode) != @SegLength
set @retval = 0
end
return @retval
end