sql server odbc:
[quoted text, click to view] "Brad Pears" <donotreply@notreal.com> wrote in message
news:%23g2cKtSvEHA.2804@TK2MSFTNGP14.phx.gbl...
> Since SQL server keeps track of every modification to a table during a
> transaction, if I change a field value in a single row of a table, where
do
> I look to find the log file that was generated that will tell me what the
> old value was and what it is now?
>
> Also, is there a way to have SQL keep track of specifc changes regardless
of
> whether or not the change was part of a transaction?
>
> Thanks,
>
> Brad
The SQL Server Transaction logs keep track of *all* changes to the database,
whether or not they were contained in formal transactions (BEGIN TRANS,
etc.). That is, *if* you have SQL Server's Recovery model set to either Full
or Bulk-logged. The transaction logs created are not viewable AFAIK; they
are for restoring the database after a crash, etc. The scenario is: your db
server crashes - you rebuild it, then restore the last full backup, then
apply the transaction log(s) and Bingo! you're back to where you were before
the problem!
Now, as to whether SQL server can track specific changes. The short answer
is yes. But it will require you to study some advanced concepts in SQL Books
Online, like Triggers. Basically a Trigger is code that executes in
repsponse to a SQL statement. So you can have Insert, Update and Delete
triggers on any table to create an audit trail. In the code of a trigger,
you can write the data that is being changed to an audit table along with
the user's name, date and time, etc.