Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Triggers When to Use

Author  Topic 

jesus4u
Posting Yak Master

204 Posts

Posted - 2004-06-07 : 08:27:13
I have a shopping cart and I need to remove items out of stock temporarily when a user adds the item to their cart and then add the quantities back to stock ONLY if the item is greater than 15 minutes.

My question is if triggers would be a good solution when a user adds an item to the cart to handle the removal of item quantity? Or is there a better way?

Alex

nr
SQLTeam MVY

12543 Posts

Posted - 2004-06-07 : 08:51:31
If all your database access is via stored procs then you can put it in the stored proc.
You will need a scheduled task to check for the timeout to add the item back in.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

jesus4u
Posting Yak Master

204 Posts

Posted - 2004-06-07 : 08:55:33
Can you briefly explain why SP is better?

quote:
Originally posted by nr

If all your database access is via stored procs then you can put it in the stored proc.
You will need a scheduled task to check for the timeout to add the item back in.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.

Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2004-06-07 : 08:59:05
Do a search - you will find lots of discussions.
In your particular case it saves having to add triggers. Triggers make the system a lot more difficult to understand as well as holding locks and slowing everything down.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -