Posted by solidsna2 on 03/01/06 19:17
I am working with an application that use SQL to store it's data. What
I am trying to achieve is to execute the query below every hour.
UPDATE Tbl1
SET Tbl1.Flag = '0'
WHERE Tbl1.Flag <> '0'
UPDATE Tbl1
SET Flag = '1'
WHERE Tbl1.Key = (SELECT Tbl2.Key
FROM Tbl2
WHERE Tbl2.Key = Tbl1.Key
AND CURRENT_TIMESTAMP >= Tbl2.Expdate GROUP
BY Tbl2.Key)
DELETE Tbl2
WHERE CURRENT_TIMESTAMP >= Tbl2.Expdate
The Query does exactly what I want it to do. Now I want to launch this
query from the application I was talking about earlyer. So I thought
that if I use a trigger that will be iniated by a script in my
application by changing a value to 1 or 0 every hour. This will then
activate the SQL trigger that will execute the query above. I strore
the query in a views. So that is why I ask how to execute a views with
a trigger.
Maybe this is not the way to go, but I hope you can understand what I
am trying to do.
Thank you again.
Philippe
Navigation:
[Reply to this message]
|