Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7032779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:58:45+00:00 2026-05-28T00:58:45+00:00

I need a solution for the following problem: I will have a table in

  • 0

I need a solution for the following problem:

I will have a table in SQL server 2008 that will be changing daily. It’s a small table with maybe 5000 rows at most and around 5 fields.

The client will need the ability to view all the data in the table the way it was at a given point in time. For example “show me what all the data looked like in the table 2 weeks ago”.

Someone had mentioned that auditing the table with http://autoaudit.codeplex.com/ would solve this problem.

My questions:

  1. Is there a solution to this problem that would involve simple auditing?
  2. If so, then how would i use auditing to solve this problem?
  3. Is there a different solution already in existence for this sort of challenge so that I do not have to reinvent the wheel?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T00:58:46+00:00Added an answer on May 28, 2026 at 12:58 am

    Have an auditing table that get’s manipulated by triggers. Something like:

    create table YourAuditTable
    (
        -- all of your source table's columns
        CreateDate datetime not null,
        DeleteDate datetime null
    )
    go
    

    And your trigger would look like this:

    create trigger AuditYourTable
    on dbo.YourTable
    after insert, update, delete
    as
    
        if exists(select * from inserted)
        begin
            if exists(select * from deleted)
            begin
                -- this is for an update
                update YourAuditTable
                set DeleteDate = getdate()
                where YourIDCol in (select YourIDCol from deleted)
            end 
    
            -- this is just for an insert
            insert into YourAuditTable
            select *, getdate() as CreateDate
            from inserted
        end
        else
        begin
            -- this is just for a delete
            update YourAuditTable
            set DeleteDate = getdate()
            where YourIDCol in (select YourIDCol from deleted)
        end
    
    go
    

    What this will allow you to do is query your audit table for a point in time. In other words, just use DATEDIFF to determine if a row was created prior to that given point in time, and deleted after it (or not deleted at all).

    EDIT

    To query your audit table for point in time data:

    select *
    from YourAuditTable
    where CreateDate <= @PointInTimeDateTime
    and
    (
        DeleteDate is null or
        DeleteDate > @PointInTimeDateTime
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Folks, I need a solution that allows drag-and-drop cell over the table. The cells
I have a cat table that has the following columns: cat_id | name |
I have the following problem, which seems not to have a nice solution. For
Alright, so I have a table that I need to store in a database.
I need to create a process that will extract the changes from a table
I am following up from this question here The problem I have is that
Hi all SQL Server Blackbelt masters out there. I have a simple question that
I have a problem that is common, but I am not quite sure exactly
I have a problem on the following situation: In my Spring, Hibernate application I
Imagine that I have a Debtor class. With Hibernate, I will define the class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.