[dba-SQLServer] TicketMaster-like Timer

Arthur Fuller artful at rogers.com
Sun Dec 19 23:05:20 CST 2004


I have a requirement that I have virtually no experience in handling. I 
named the subject of this message due to the similarity of my 
requirement and the functionality of that site. The general idea is 
this. You want to grab some inventory and hold it for N minutes, making 
the available inventory equal P - Requested Qty. Then another sproc will 
perhaps fire that seals the grab and sets Actual Inventory to P - 
Requested Qty (i.e. the credit card was authenticated and the qty was 
sold). Failing that, upon expiry of N minutes the Request is cancelled 
and the Available Inventory is reset to P. I hope this is clear. Here is 
an example:

Client wants 4 units.
Inventory is 10 units.
Set the timer to N minutes, and show available as 6 units.
Client completes transaction, then set actual inventory to 6 units.
Timer expires without completion, reset available inventory to 10 units.

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.

TIA,
Arthur

Arthur Fuller wrote:

> Always happy to help, Francisco, especially given the number of times 
> you have helped me. But on this one I think I need a little more 
> explanation. Are you wanting an empty row to appear for the months 
> that are missing, or what?
>
> Arthur
>
> Francisco Tapia wrote:
>
>> perhaps someone here can help me out so this reporting goes a lot 
>> smoother :)
>>
>> Here is a sample snapshot of my data
>>
>> 8/1/2003, 1, SampleText, Qty1
>> 10/1/2003, 1, SampleText, Qty1
>> 11/1/2003, 1, SampleText, Qty1
>> 1/1/2004, 1, SampleText, Qty1
>> 8/1/2004, 1, SampleText, Qty1
>>
>> There is only data for these months... would you create a temp table
>> to fill in the rest of the months within the criteria?
>>
>> ex: 8/1/2003 - 8/31/2004
>>
>>
>>
>>  
>>
>
>


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.296 / Virus Database: 265.6.0 - Release Date: 12/17/2004




More information about the dba-SQLServer mailing list