Hi,
I've been given the following task:
An external source will write a name, datetime and value to a database table (table A) at random intervals. I need to copy this data to another table (table B) and delete the row in table A. If the name doesn't exist in a lookup table then the row needs to remain in table A until it does and then copied over to table B.
Does the above sound like a situation where a database trigger could be used effectively or would it be better creating an external app (maybe windows service) that checks the db every 5 min and performs the necessary updates?
Update:
This does not necessarily need to be instant thus if I used a windows service or task scheduler it would probably be set at 5 min intervals. It being virtually instant if a trigger is used is just a bonus of using a trigger, not a deciding factor.
My main concern is that is this the correct way of using a trigger? Should triggers be used to copy data or is this bad practise? Also could have problems with using a trigger, for example if a copy fails could it lock the table stopping subsequent rows being copied? If one copy takes too long will it not process the rows that have been inserted while it was bus? If I don't use a trigger is there a better solution e.g. a windows service or console app using windows schedular?
Thanks