USP_RECORDOPERATION_ASKLADDERTOGGLEACTIVE
Executes the "Ask Ladder: Toggle Active Flag" 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. |
Definition
Copy
create procedure dbo.USP_RECORDOPERATION_ASKLADDERTOGGLEACTIVE
(
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null
)
as
set nocount on;
declare @isactive bit;
select @isactive=[ISACTIVE] from dbo.[MKTASKLADDER] where [ID]=@ID;
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
update
dbo.[MKTASKLADDER]
set
ISACTIVE = (case @isactive when 0 then 1 else 0 end),
CHANGEDBYID = @CHANGEAGENTID,
DATECHANGED = getdate()
where
[MKTASKLADDER].[ID] = @ID;
return 0;