SQLTeam.com | Weblogs | Forums

Insert updated row into another table

sql2008

#1

I am trying to capture all the times users log into our back office system. Currently the table has a list of the users with a field for when they logged in and a field when they logged out. This keeps getting updated everytime the log in and out.

I would like to create a log table which keeps all the times they have logged in and out. I am thinking the way to do this is insert the update into another table. I would very much appreciate any help on this.


#2

Using a correctly coded, high performance trigger is the easiest way to do this. Only save from the "DELETED" trigger table to avoid incredibly massive duplication. The latest data will ALWAYS be in the original table.