Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2007
    Posts
    2

    Unanswered: How to log any activity

    Dear friends,
    I'm working on an entity relationship diagram about a mice farm.
    Let's say we have a very very basic diagram like this:

    MOUSE "is in" CAGE

    For example, this gives

    Mouse "n1500" is in cage "AAA"
    Mouse "n1501" is in cage "BBB"

    One operator can take one mouse and put it into another cage, for
    example the first line becomes

    Mouse n1500 is in cage CCC

    Now, I was asked to track any movement... I ask myself: do I need to
    add

    OPERATOR "moves" MOUSE

    so that I have

    Operator "John" moves Mouse "n1500" on "Monday 3rd, 2007" at "5 PM"
    from "AAA" to "CCC"?

    or this kind of logging is provided some way by SQL server?

    Thanx a lot for any hint.

  2. #2
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    Not automatically.

    You could add a trigger and an audit table to your database, so that every time a record is inserted updated, the pertinent data would be logged to the audit table.

    ref Using TRIGGERS to add an audit trail to a table

    Note that the example shown doesn't audit the data which was changed, but that is easy to add.

    Note: Since you're asking specifically about SQL Server, I'm moving this thread there (to the SQL Server Forum).
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •