USP_CONSTITUENTSOURCEANALYSIS_UPDATE

Updates cached values for constituent source analysis.

Parameters

Parameter Parameter Type Mode Description
@CHANGEAGENTID uniqueidentifier IN
@CHANGEDATE datetime IN

Definition

Copy


            CREATE procedure dbo.USP_CONSTITUENTSOURCEANALYSIS_UPDATE
            (
                @CHANGEAGENTID uniqueidentifier = null,
                @CHANGEDATE datetime = null
            )
            with execute as owner
            as
            set nocount on;

            begin try
                if @CHANGEAGENTID is null
                    exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
                if @CHANGEDATE is null
                    set @CHANGEDATE = getdate();

                --JamesWill WI 24976 2009-02-18 The @CHANGEDATE that gets passed in from the SSIS package will be the "Data Window Open" time. In order for the data that gets added by this

                --SP to actually be in the Data Window, we need to increment the @CHANGEDATE by one second.

                set @CHANGEDATE = dateadd(second, 1, @CHANGEDATE);

                exec dbo.USP_CONSTITUENTSOURCEANALYSIS_UPDATEADDRESS @CHANGEAGENTID, @CHANGEDATE;

                exec dbo.USP_CONSTITUENTSOURCEANALYSIS_UPDATESYSTEMCONSTITUENCY @CHANGEAGENTID, @CHANGEDATE;

                exec dbo.USP_CONSTITUENTSOURCEANALYSIS_UPDATESMARTFIELD 'CONSTITUENTSOURCEANALYSISCACHESMARTFIELDLIFETIMEGIFTSONFILE', 'Constituent Lifetime gifts on file', 'int';

                exec dbo.USP_CONSTITUENTSOURCEANALYSIS_UPDATESMARTFIELD 'CONSTITUENTSOURCEANALYSISCACHESMARTFIELDLIFETIMEGIVING', 'Constituent Lifetime giving', 'money';

                exec dbo.USP_CONSTITUENTSOURCEANALYSIS_UPDATESMARTFIELD 'CONSTITUENTSOURCEANALYSISCACHESMARTFIELDYEARSASDONOR', 'Constituent Years on file', 'nvarchar';
            end try
            begin catch
                exec dbo.USP_RAISE_ERROR;
                return 1;
            end catch

            return 0;