Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Peace2007
Posting Yak Master
239 Posts |
Posted - 2009-04-22 : 03:48:41
|
Hi, I need to have a history of data changes in MS SQL2005 to know which data are updated by which queries at what time. Any suggestion is appreciated |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-04-22 : 03:54:20
|
You can use triggers, you can use Change Data Capture if you on Enterprise Edition.Soon WhiteFang will post something about "Do not use triggers because they are bad", but without anything substantial backing up his arguments. You can listen to him of you want.A simple trigger like this will sufficeCREATE TRIGGER dbo.trgMyTriggerON MyTableAFTER UpdateASSET NOCOUNT ONINSERT MyLogSELECT d.Col1 AS OldValue, i.Col1 AS NewValue, GETDATE()FROM inserted AS iINNER JOIN deleted AS d ON d.pkCol = i.pkColWHERE d.Col1 <> i.Col1 E 12°55'05.63"N 56°04'39.26" |
 |
|
Peace2007
Posting Yak Master
239 Posts |
Posted - 2009-04-22 : 04:02:08
|
Thanks PesoBut I need this information about all tables of around 10 databases in a server! |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
|
|