USP_EXCHANGEUSER_ADDAPPUSER

Stores exchange information by application user.

Parameters

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

Definition

Copy


            create procedure dbo.USP_EXCHANGEUSER_ADDAPPUSER
            (
                @APPUSERID uniqueidentifier,
                @CHANGEAGENTID uniqueidentifier
            )
            as
                set nocount on;

                declare @CURRENTDATE datetime

                if @CHANGEAGENTID is null  
                    exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;

                set @CURRENTDATE = getdate();

                if not exists(select ID from dbo.EXCHANGEUSER where EXCHANGEUSER.APPUSERID = @APPUSERID) begin
                    insert into dbo.EXCHANGEUSER
                        (APPUSERID, ADDEDBYID, CHANGEDBYID, DATEADDED, DATECHANGED) 
                    values 
                        (@APPUSERID, @CHANGEAGENTID, @CHANGEAGENTID, @CURRENTDATE, @CURRENTDATE)
                end;