USP_CHANGEAGENT_GETORCREATECHANGEAGENTFROMCONTEXT

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier INOUT

Definition

Copy



create procedure dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENTFROMCONTEXT
    @ID uniqueidentifier output
with execute as caller
as

declare @ContextInfo varbinary(128);

/* get current context information */
select @ContextInfo = CONTEXT_INFO();

/* validate agent in context */
select @ID=ID
from dbo.CHANGEAGENT
where ID = CAST(@ContextInfo as uniqueidentifier);

/* if invalid then use default */
if @ID is null
    exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @ID output;

return 0;