SQL SERVER - Check for changes to a SQL table?

How can I monitor a MSSQL database for changes to a table without using triggers or modifying the structure of the database in any way? My preferred programming environment is .Net and C#

(edits)

I'd like to support MS SQL 2000 SP4 or higher

by "changes to a table" I mean changes to table data, not changes to table structure.

Ultimately, I would like the change to trigger an event in my application, instead of having to check for changes at an interval.

This question and answers originated from www.stackoverflow.com
Question by (8/1/2008 12:35:56 PM)

Answer

Take a look at the CHECKSUM command:

SELECT CHECKSUM_AGG(BINARY_CHECKSUM(*)) FROM sample_table WITH (NOLOCK);

That will return the same number each time it's run as long as the table contents haven't changed. See my post on this for more information:

http://msdn.microsoft.com/en-us/library/aa258245(SQL.80).aspx

Here's how I used it to rebuild cache dependencies when tables changed: http://weblogs.asp.net/jgalloway/archive/2005/05/07/406056.aspx

Answer by

Find More Answers
Related Topics  sql-server  datatable
Related Questions