USP_WEALTHCAPACITY_UPDATE

Updates the information in the WEALTHCAPACITY table given an ID

Parameters

Parameter Parameter Type Mode Description
@WEALTHID uniqueidentifier IN
@CHANGEAGENTID uniqueidentifier IN

Definition

Copy


            CREATE procedure dbo.USP_WEALTHCAPACITY_UPDATE (
                @WEALTHID            uniqueidentifier,
                @CHANGEAGENTID        uniqueidentifier = null
            ) as begin

                set nocount on;

                if @WEALTHID is not null
                begin
                    begin try
                        declare @ISGROUP bit;
                        select @ISGROUP = ISGROUP from dbo.CONSTITUENT where ID = @WEALTHID;

                        -- Update the wealth capacity if the constituent isn't a group and the wealth capacity has not been confirmed or there is no wealth capacity.

                        if @ISGROUP = 0 and (not exists(select 1 from dbo.WEALTHCAPACITY where ID=@WEALTHID) or exists(select 1 from dbo.WEALTHCAPACITY where ID=@WEALTHID and CONFIRMED=0)) begin
                            exec dbo.USP_WEALTHCAPACITY_UPDATECOMMON @WEALTHID, @CHANGEAGENTID;
                        end
                    end try
                    begin catch
                    end catch
                end;
                return 0;
            end;