How do you make your application aware that a database record was changed or created by an external application rather than the application itself?
Do you add a special check sum to the database record or what do you do to stop external changes to the database? (in case it was hacked and the hacker decides to add a new record or change an existing database record)
There are three questions being asked:
You have a handful of choices:
rowversioncolumn (called atimestampin older versions of SQL Server) which will update itself every time the row is changed. This will only tell you that something changed but not what column was changed or who changed it.This one is a bit trickier. Technically, you might think that simply writing the name of the app into a column in the row might suffice but that technique is not safe. An external application that has rights to save to this column could easily do the same. The safer way would be to use an external monitoring program that tracks every change made to the database and the user that made it. In SQL Server 2008, there is a feature called “Change Tracking” which revolves around similar functionality which also might suffice.
The obvious choice is to restrict access to the database. Only let the application account have access to the database and/or access to the tables and stored procedures. In addition, you need to lock down access by administrators and developers to the database so that only a select few can access the database. Combined with good logging, that should prevent mystery rows from appearing.