This topic has been archived. It cannot be replied.
-
工作学习 / 专业技术讨论 / ms sql server 高手请进有个问题求解:
假定我有多个CLIENT程序在不同机器上运行 。要处理的数据是一个VIEW里面有xxx条记录,并且有随时追加的可能(其他应用)。限制每个CLIENT每次只可以装入20条记录,处理完了再取那些没有被其他CLIENT装入的数据中的20条。有什么方法或逻辑实现那?
-bewitched(冰心寒剑);
2005-11-7
{246}
(#2595343@0)
-
create a temp table, load the data to be process into the temp table use a trigger, lock the record when do processing, unlock/delete after done.
-mutantx(阿吉);
2005-11-7
(#2595379@0)
-
creat temp table for each active client?
-bewitched(冰心寒剑);
2005-11-7
(#2595458@0)
-
Create only one table for all clients, which will serve as a queue.
-mutantx(阿吉);
2005-11-9
(#2598249@0)
-
why use trigger
-ubs(ubs);
2005-11-9
{868}
(#2598559@0)
-
Trigger is to populate the queue. You can use other methods as you wish.There should be only one control thread that can populate the queue though. All other clients (worker thread) should just retrieve from the top of queue and do processing. Otherwise, it will be very easy to get into a deadlock situation. Ideally, the control thread should also distribute the tasks.
-mutantx(阿吉);
2005-11-9
{302}
(#2598818@0)