July 31, 2007 at 7:23 am
Hi to all,
just a quick question.
Is it possible to have some live check on a view that the instance any data is present in the view a store procedure is invoked.
e.g. if i have a customer list and a view on a report which contains all the newly entered customers, thus for a any newly eneterd customer how can i have the view react by running a stored procedure upon the instance it has a new row within it.
Any ideas?
Cheers
July 31, 2007 at 7:55 am
July 31, 2007 at 8:10 am
You cannot have a trigger on a view. A view is materialized when it's called, it does not exist on it's own.
Why not a trigger on the underlying tables?
July 31, 2007 at 8:16 am
Yeah i thought so but was wondering if there is anything else that could be set to monitor the view, as it is pulling data in externally through openquery and not hard copy tables in sql itself.
July 31, 2007 at 8:22 am
There's nothing to do that. I'm assuming you want to be notified when new data appears in the tables.
Best way to handle this is write a stored proc to do it, check the view somehow (record count, date/time, etc), and then send an email when new data appears. Or raise some semaphore.
Most things that people do in triggers, don't need to be there. Every minute is often. If you got an email every minute for new data, you'd be annoyed. If you got one every 10sec, you'd be really annoyed.
July 31, 2007 at 8:31 am
Ok, just as i thought thanks a lot i'll create a sql job to handle this.
cheers
Viewing 7 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply