2

I've a User table and It's data can be added/ updated from a User Screen. I want detail of all transactions on any row.

For example, I have data in table like this

Name - Age - Salary

John - 25 - $10

Jazy - 23 - $10

Then some user update john's Age like this

Name - Age - Salary

John - 20 - $10

Jazy - 23 - $15

and then Update its Salary like this

Name - Age - Salary

John - 20 - $20

Jazy - 23 - $15

I want a query to get all transactions on John's records like this

John - 25 - $10

John - 20 - $10

John - 20 - $20

Is there any way to get data like this??

2

Edit: Forgot that Change data capture is already in 2008, you could use it to capture the data, or create your own log/history table using triggers or something similar.

If you were in SQL Server 2016, then you could use temporal tables

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.