SQL Server's Data Change Notification

  • Thread starter Thread starter Nick Pritchard
  • Start date Start date
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...
 
-----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?
 
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
 
Back
Top