Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

Am building an application, there is a registration form where user enters the data and save it into the database. Well, there is a form field which is called Target Assigned, basically what it does is it assigns the targets to the particular name.

Example: SQL Table

SQL
Name  ||  Target Assigned
XYZ   ||  123
ABC   ||  235


Now, at certain times the user assigns a new targets to the particular name.

SQL
Name  ||  Target Assigned
XYZ   ||  124
ABC   ||  365


I can easily update the table using SQL commands but here i need a logic where i can save the old target value and name associated along with date and time and should be retrieved at any given point of time by the user.

Basically, it should show all the previously assigned targets with date and time.

Any suggestions, please?
Also, please throw a light on the LOG file creation.

Thanks
Saikrishna

What I have tried:

I have not tried anything since am lacking the logic to create.
Posted
Comments
dan!sh 9-Mar-16 3:03am    
Take a look at this article here at CP. You can probably use an extra SQL statement to populate shadow table if you do not want to use trigger.
Member 10376341 9-Mar-16 4:11am    
Thank you for the reply Danish. Can i get the Ref link?
jaket-cp 11-Mar-16 4:59am    
Did you find the link from d@nish?
Richard Deeming 10-Mar-16 13:53pm    
Probably not a lot of help right now, but SQL Server 2016 will have support for this kind of log built-in:
Introduction to SQL Server 2016 Temporal Tables[^]
Temporal Tables[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900