USP_BATCH_ALLOWEDIT
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@BATCHID | uniqueidentifier | IN | |
@RESULT | bit | INOUT |
Definition
Copy
create procedure dbo.USP_BATCH_ALLOWEDIT
(
@BATCHID uniqueidentifier,
@RESULT bit = 0 output
)
as
begin
-- Call function first
set @RESULT = dbo.UFN_BATCH_ALLOWEDIT(@BATCHID);
if @RESULT = 1
begin
-- Perform checks that we cannot perform from a function if the function rules the batch editable
declare @ISLOCKED bit = 0;
exec dbo.USP_BATCH_HASEXCLUSIVELOCK @BATCHID, @ISLOCKED output;
-- Do not allow edit if another process has an application lock on this batch
if @ISLOCKED = 1
set @RESULT = 0;
end
end