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 |
|
theboyce
Starting Member
2 Posts |
Posted - 2007-12-14 : 08:00:35
|
| Hi,I would like to create a trigger that will calculate the time from the last record updated and insert it into that table.For example, the new table will be called Line1, the two fields will be TimeStampA and Duration.As the current table is updated, the trigger should work as follws-14/12/07 10:30:00 014/12/07 10:30:33 3314/12/07 10:30:51 22If you can follow the above example - I need to calculate the duration based on the new timestamp ie. how to insert 33 and 22is this possible ? - thanks for any guidance |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-12-14 : 08:02:32
|
why trigger ? you want an Insert or update trigger ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2007-12-14 : 08:04:43
|
| You are better off doing this in your SP you use to insert/update. |
 |
|
|
theboyce
Starting Member
2 Posts |
Posted - 2007-12-14 : 08:10:04
|
| Thanks for the two responses to help. The original data is auto updated from sw supplied to company ie. via a VB system that I cannot touch so I only have a table of timestamps but no durations. I am happy to create a view from this data but i am not sure if it is possible to then create the duration field that I require in the view - or to update the table to create the durations ?thanks again |
 |
|
|
|
|
|