user1037134
user1037134

Reputation:

How to store history answer data in sql database?

I have a system whereby it can set the open and close dates allowing user to go in and submit answer for survey. The system also wants to delete the most current records from the database.

Example:

Person A:

How can i make sure that data are stored securely and able to retrieve past records and still able to delete latest?

I am thinking of storing latest data on one database and the history data on another database where it could be permanent. But then if records continue to be submitted, will it affect the search if there are more and more data stored? Any suggestion please? Heard about sql08 auditing? does it work?

Upvotes: 0

Views: 494

Answers (1)

Jordan
Jordan

Reputation: 32522

Why would you want to store them in separate databases, and why would the history be any different than the latest? Just store all their answers for all time.

For the most simple example, if it's a single table for a survey, just store their user id, a unique survey id, and the date that it was submitted. When you want to get the most recent, get the Top 1 sorted by the submit date in descending order.

Upvotes: 2

Related Questions