You are here: Re: Executing a Views from a Trigger « MsSQL Server « IT news, forums, messages
Re: Executing a Views from a Trigger

Posted by DickChristoph on 03/01/06 19:30

Hi

If you want to execute this every hour, this would be better handled in a
scheduled job. Which can be scheduled to run a SQL Statement or stored
procedure every hour.

Although you could schedule the application to run an update query (without
a Trigger or View) every hour, what if the application isn't running all the
time? or if there are muttiple instances of it running?

One point of clarification you cannot execute and Update Query in a View.

-Dick Christoph

--
<solidsna2@gmail.com> wrote in message
news:1141233438.780742.274780@t39g2000cwt.googlegroups.com...
>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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация