April 21, 2014 at 4:48 am
we do have requirement of tracking insert,update and delete action of tables with tracking userid.
two approach is there.
1) creating single table with below fields:
LogID int
TableName int
Action tinyint (1= Insert,2=Update,3=Delete)
RecordID int
UserID int
CreatedDate DateTime(Default will be current date)
2) Add below fields in all the tables:
modifieddate datetime
modifiedUser int
transactionType Char(1) --this will have action like 'I','D' or 'U' for insert update and delete
which approach will be good for performance ?
April 21, 2014 at 5:32 am
April 21, 2014 at 7:24 am
It's not about performance, it's about what meets your requirements.
Option 2 will only show the last user who changed the row and won't show what they changed. If you need to see all the users who modified the row, then option 2 won't suffice.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
May 8, 2014 at 1:48 am
GilaMonster (4/21/2014)
It's not about performance, it's about what meets your requirements.Option 2 will only show the last user who changed the row and won't show what they changed. If you need to see all the users who modified the row, then option 2 won't suffice.
Is there any online resource that I can read on how to audit/track who change what value in a record? My audit requirement:
if some one changed a value / values in a record, I need to know who edit the record and which attribute(s) value has been changed (if possible, i need to know what was the original value)..
Thanks!
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply