Data from SQL

  • Thread starter Thread starter John J. Hughes II
  • Start date Start date
J

John J. Hughes II

I have a service that runs on one server and accesses data from another
server running SQL 2K. Is there a way other then polling to know when a
records has been changed or added or an event has occurred?

Regards,
John
 
One approach is to use an extended stored procedure attached to a trigger on
your table.
There's an example here:
http://www.codeproject.com/database/mssqltutorial.asp

The down-side (until SQL.2005) is your extended stored procedure is in an
unmanaged dll written in e.g. C++. Keep the c++ code a simple wrapper and
interop into your c#.


The "caching application block" from Microsoft also does something like this
I think - might be worth downloading to see how it works.


Finally maybe SQL server notification services is relevant? It's really
targetted at getting updates out to mobile devices, but take a look.

Hope that helps
Richard.
 
Thanks for the help but I think I will stick to polling. Maybe SQL 2K5 will
have a better solution.

Regards,
John
 
Polling is also an acceptable (and simple) solution in many scenarios.
A timestamp column is a good choice for detecting changes.

The situations where I have seen/used extended SPs and triggers is where
near-real-time-performance (sub-second) is a requirement.

R.
 
Yea, currently I check about every 60 seconds. I was checking quicker and
had several customer complaining the CPU usage was getting way up there on
less then ideal systems.

Mostly I was attempting to limit network bandwidth and reduce system
resources.

Regards,
John
 
Back
Top