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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Is this type of trigger on a view possible?

Author  Topic 

wjunk
Starting Member

6 Posts

Posted - 2007-07-31 : 09:30:17
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?

Also i'm trying to avoid the use of an SQL server agent job to check the data i'm looking for something thats reactive not pre-empted.



Cheers

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-07-31 : 09:41:20
Quick answer. I have no idea what you are talking about.

Why not call the "new customer sp" stored procedure after call then "all customer update and insert sp"?



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

wjunk
Starting Member

6 Posts

Posted - 2007-07-31 : 09:46:47
They new customer data for example is being entered in an external system and the view is a way in which you can see the newly enetered data, also the external system cannot call external programs like sql server or a simple batch file after the new customer data has been entered, thats why i'm needing something to be in real-time on an sql view.
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2007-07-31 : 09:56:16
Still not sure what you want.

Maybe a job that runs periodically and does something with newlly added data?

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

wjunk
Starting Member

6 Posts

Posted - 2007-07-31 : 10:04:46
I'm looking for some sort of trigger which will be activated as soon as the view contains a row of data. And will then run the stored procedure, i don't want to use a periodic sql job as a means of improving performance and reducing system usage.

cheers
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2007-07-31 : 10:24:50
A view won't contain any data unless it's run so you won't be able to do what you are aiming for.


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

wjunk
Starting Member

6 Posts

Posted - 2007-07-31 : 10:31:37
ok ill create an sql job to handle this

cheers
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2007-07-31 : 11:29:46
You could maybe use the profiler.
Leave it running filtering on this table and logging to a table in your database. Have a trigger on the log table which does whatever you wish when an entry is added.


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-07-31 : 12:18:55
A trigger on the underlying table could check whether any of the record(s) being inserted was "new", and then call the Sproc to further process it

Kristen
Go to Top of Page
   

- Advertisement -