Question

What is the "best" way to look for changes in tables on a SQL Server 2008 instance? We have an external application and the user wants to be "informed", when changes happen...

Today we use triggers, but the performance is not the best.

I thougt SqlDependency (Service Broker) in combination with .NET (C# application...) is faster. Or are there any other possibilities?

Thanks in advance, Frank

Was it helpful?

Solution

Consider using Change Tracking.

Change tracking is a lightweight solution that provides an efficient change tracking mechanism for applications. Typically, to enable applications to query for changes to data in a database and access information that is related to the changes, application developers had to implement custom change tracking mechanisms. Creating these mechanisms usually involved a lot of work and frequently involved using a combination of triggers, timestamp columns, new tables to store tracking information, and custom cleanup processes.

Synchronous change tracking will always have some overhead. However, using change tracking can help minimize the overhead. The overhead will frequently be less than that of using alternative solutions, especially solutions that require the use triggers.

OTHER TIPS

If you would change your strategy to use stored procedures for altering data, your stored procedure could send change notification along with updating data.

Change notification can be implemented f.ex. as another table, watched by your application.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top