USP_WEALTHCAPACITYFORMULA_SETDEFAULT

Executes the "Wealth Capacity Formula: Set Default" record operation.

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN Input parameter indicating the ID of the record being updated.
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the update.
@CURRENTAPPUSERID uniqueidentifier IN Input parameter indicating the ID of the current user.

Definition

Copy


                    create procedure dbo.USP_WEALTHCAPACITYFORMULA_SETDEFAULT (
                        @ID uniqueidentifier,
                        @CHANGEAGENTID uniqueidentifier,
                        @CURRENTAPPUSERID uniqueidentifier
                    ) as
                        set nocount on;

                        declare @CURRENTDATE datetime;
                        set @CURRENTDATE = getdate();

                        update
                            dbo.WEALTHCAPACITYFORMULA 
                        set
                            ISDEFAULT = 0,
                            DATECHANGED = @CURRENTDATE,
                            CHANGEDBYID = @CHANGEAGENTID
                        where
                            ID <> @ID and
                            ISDEFAULT = 1;

                        update
                            dbo.WEALTHCAPACITYFORMULA 
                        set
                            ISDEFAULT = 1,
                            CHANGEDBYID = @CHANGEAGENTID,
                            DATECHANGED = @CURRENTDATE
                        where
                            ID = @ID;

                        return 0;