SQL Server's Data Change Notification

N

Nick Pritchard

Well, there are a couple ways you could do that.

You could write a windows service with a
System.Timers.Timer object, that fires an event ever 15
minutes. Or, you could use a trigger on the table you are
evaluating. On update for your table, your trigger fires
executing a piece of code that could be a SQL job, or an
actual executable you had written in VB or VB.net. The
easiest programatic way would probably be the service
though.

Cheers...
 
M

Mo Quamar

-----Original Message-----
Well, there are a couple ways you could do that.

You could write a windows service with a
System.Timers.Timer object, that fires an event ever 15
minutes. Or, you could use a trigger on the table you are
evaluating. On update for your table, your trigger fires
executing a piece of code that could be a SQL job, or an
actual executable you had written in VB or VB.net. The
easiest programatic way would probably be the service
though.

Cheers...


.
Thanks for you reply.
Yes, I am writing this process using Windows Servce and
using Update Trigger, how do I know which record has
changes?
 
A

Alexander

The most easy way is to create a table and inset in it a record index and
change time on trigger event.
Then your service can red this table and empty it, or keep it and just
select after particuar time.

Code can look like:
CREATE TRIGGER watchTrigger
ON <table_name, sysname, pubs.dbo.sales>
FOR INSERT, UPDATE
AS
BEGIN
insert watchTable ([ID], ChangeTime) select [ID], getdate() from inserted
END
GO
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top