В следния код. Само един от изразите 'Select' ще бъде изпълнен в даден момент. Искам да мога да актуализирам „Състоянието“ на всеки от избраните редове, както и да върна данните. Това основно предотвратява извличането на едни и същи записи по време на обработка в задната част.
Благодаря!
-- Insert statements for procedure here
if(@BatchSize > -1 and @Priority > -1)
begin
Select TOP(@BatchSize) *,ID
From CompingQueue
Where PriorityLevel=@Priority
and Status=35
order by PriorityLevel asc;
end
if(@BatchSize = -1 and @Priority = -1)
begin
Select * From CompingQueue
Where Status=35
order by PriorityLevel asc;
end
if(@BatchSize = -1 and @Priority > -1)
begin
Select * From CompingQueue
WHEre PriorityLevel=@Priority
and Status=35
order by PriorityLevel asc;
end
if(@BatchSize > -1 and @Priority = -1)
begin
Select TOP(@BatchSize) *
From CompingQueue
Where Status=35
order by PriorityLevel asc;
end
--update CompingQueue set Status = 2 where ID=
-- Set the Status Flag for each job
КРАЙ