Options
Loging data changes in SQL Server 2008
Grynder
Member Posts: 106
If multiple users access and modify data what is the best way to log the changes and the user who made the changes? Or at least the last user that modified a record.
Does SQL 2008 have anything like this? or should I add 2 columns to the table that are updated with time and user every time there is a modification?
Does SQL 2008 have anything like this? or should I add 2 columns to the table that are updated with time and user every time there is a modification?
Comments
-
OptionsRobertKaucher Member Posts: 4,299 ■■■■■■■■■■This kind of depends on why you want to track the change. Is this an issue of security and wanting to know who changed what and when? Or is this a question of managing concurrency and wanting to let Bill know that the record he is viewing was changed since he opened it?
Here is an article you might want to read:
rowversion (Transact-SQL) -
OptionsGrynder Member Posts: 106It is an issue of security as you describe it. For compliance reasons, modifications have to be tracked by user and date.
I will read over the article you linked.
Thanks -
OptionsRobertKaucher Member Posts: 4,299 ■■■■■■■■■■Here is one that might also help as it focuses more on logging.
How do I audit changes to SQL Server data? -
OptionsGagHalfrunt Member Posts: 81 ■■□□□□□□□□The way I've seen it done is to either use Triggers as the URL in Robert's post mentions or what about this feature in SQL2008 known as Change Tracking?:
SQL Server 2008 - Change Tracking -
OptionsGrynder Member Posts: 106Thanks for everybody's input. I have implemented a auditing solution following the information available here Auditing (Database Engine)
But this is a topic I need to research more