>Hi
>
>Looking for a good practice to share a task across 3 machines.
>
>The same process is running on 3 separate machine and each process should get the tasks in batches of 20 items from a SQL server table, process each, and mark the record as done when completed.
>
>No duplication allowed.
>
>What's normally done to achieve this ?
>
>TIA
>John Harriss
There are multiple ways I think. One way would be to use ntile() function to divide the data into 3 partitions. ie:
machineNum = 1
text to m.lcSQL noshow
select * from
(select *,ntile(3) over(order by customerId) as batchNum from customers) allCustomers
where batchNum = ?m.machineNum
endtext
(or have a similar partition directly on table itself on SQL server).
Cetin