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.
| Author |
Topic |
|
Dmitriy
Starting Member
1 Post |
Posted - 2008-11-21 : 16:57:06
|
| Hi,I have written a trigger in my database that will set a field called PurchaseLock to True once another column in my table has been changed. However, I want PurchaseLock to be set to true only after a certain amount of time has passed since the change, probably several hours or a day. Is this possible? I'm guessing you can't have a trigger wait 5 hours before updating a value. Could the trigger somehow schedule a stored procedure that would update the value? Or is there another way?Thank you |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
LoztInSpace
Aged Yak Warrior
940 Posts |
Posted - 2008-11-21 : 20:26:34
|
| Why not use a trigger (or sp) to record the date & time you changed the row? That way you can work out whether 5 hours have passed using getdate().And no you can't (well, should not) have a trigger delayed by 5 hours. Think about it. Each transaction would be 5 hours long - you could never know anything about a row until 5 hours had passed! |
 |
|
|
|
|
|