UFN_PDCONSTITUENCYUSED
Returns 1 if Constituency is used in the account structure
Return
Return Type |
---|
bit |
Definition
Copy
CREATE function dbo.UFN_PDCONSTITUENCYUSED()
returns bit
with execute as caller
as
begin
declare @PDCONSTITUENCYUSED bit
if exists (select * from dbo.PDACCOUNTSTRUCTURE where PDACCOUNTSYSTEMID = '4B121C2C-CCE6-440D-894C-EA0DEF80D50B' and PDACCOUNTTABLESAVAILABLEFORSEGMENTID = 'DF02810D-D5AF-4772-B112-75BB225ED0A2')
set @PDCONSTITUENCYUSED = 1
else
begin
if exists (select * from dbo.PDCOMPOSITESEGMENTTABLELIST inner join dbo.PDACCOUNTSTRUCTURE on PDCOMPOSITESEGMENTTABLELIST.PDCOMPOSITESEGMENTID = PDACCOUNTSTRUCTURE.PDACCOUNTTABLESAVAILABLEFORSEGMENTID where PDCOMPOSITESEGMENTTABLELIST.PDACCOUNTTABLESAVAILABLEFORSEGMENTID = 'DF02810D-D5AF-4772-B112-75BB225ED0A2' and PDACCOUNTSTRUCTURE.SEGMENTTYPE = 4 and PDACCOUNTSYSTEMID = '4B121C2C-CCE6-440D-894C-EA0DEF80D50B')
set @PDCONSTITUENCYUSED = 1
else
set @PDCONSTITUENCYUSED = 0
end
return @PDCONSTITUENCYUSED
end