Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2006
    Posts
    21

    Unanswered: Tracking Old New Values

    im trying to create a procedure that will insert/update a small table
    that has an ID, AmtBefore & AmtAfter.

    this is just a table that i'd be using to monitor other activity on the database.

    i'm really pulling a price + ID every hour and i need to track that somehow and know when the procedure runs if a price is lower than it was the last hour, plus of course keep the ID's straight.
    does anyone have a good approach to something like this?

    thanks for any help on this
    rik

  2. #2
    Join Date
    Jan 2006
    Posts
    21
    you know i think i figured this out shortly after i wrote it. im using a #temp table when i pull my query everyhour (with one exception) in that query, i include the AmtAfter value and put it in the AmtBefore column. then i clear out my other temp table and do an Insert from #Temp. it seems to consistently be sliding the AmtAfter Value over to AmtBefore each time. Pretty simple really, i just couldnt find an elegant simple way of doing it. if anyone has a different way though, i'm always open to other's logic.
    thanks
    rik

  3. #3
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    triggers populating history tables are perfect for this.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •