[dba-SQLServer] TicketMaster-like Timer

Stuart McLachlan stuart at lexacorp.com.pg
Sun Dec 19 23:46:42 CST 2004


On 20 Dec 2004 at 0:05, Arthur Fuller wrote:

> Note:
> It could happen that Q clients request units (i.e. 10 available, Client 
> 1 requests 4, Client 2 requests 2, Client 3 requests 2), so I need in 
> this case 3 timers and also the ability to display the available 
> inventory as the actual inventory minus the sum of the requests. 10 - (4 
> + 2 + 2) = 2.
> 
> My colleagues and I have kicked this problem around and we've decided 
> this is a back-end challenge. How convenient for them! I really have no 
> clue how to attack this. Suggestions most gratefully accepted.
> 

First thoughts:

tblCurrentlyProcessing
    ClientID
    UnitID 
    Qty
    Date/Time Requested


When the request is first received decrease UnitsAvailable in main table 
and add new record to tblCurrentlyProcessing.
When completed, delete record from tblCurrentlyProcessing.
Once per minute or whatever run a procedure that deletes expired records 
from tblCurrentlyProcessing and adds back unused units to main table.

-- 
Stuart





More information about the dba-SQLServer mailing list