Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2008
    Posts
    8

    Unanswered: Table comparison

    Hi,
    I have a table in sql server 2000.I delete some rows in the table.I would like to know the differences before & after deletion. Is it possible?

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Um. Not sure what you mean....
    Code:
    BEGIN TRAN
    SELECT * FROM table 
    
    DELETE FROM table WHERE x = 'y'
    
    SELECT * FROM table 
    
    ROLLBACK TRAN
    ?????

  3. #3
    Join Date
    Jan 2004
    Location
    In a large office with bad lighting
    Posts
    1,040
    1. Create an Audit table
    2. Create a delete trigger to write deleted rows to audit table.
    3. Delete rows in production table, and they automagically appear in Audit table!

    -- This is all just a Figment of my Imagination --

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Quote Originally Posted by seenarachel
    Is it possible?
    Yes

    Care to clarify your parameters?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  5. #5
    Join Date
    Feb 2004
    Location
    Burbank & Santa Cruz de la Sierra
    Posts
    3,716
    If I understand what you are asking, we accomplish this quite a bit using full outer joins on the primary key values in the two tables. We use this quite a bit to make sure a few critical processes on two parallel server sets are staying in synch during the processing day.
    aka "Paul"
    Non est ei similis.

    I just read "100 Things To Do Before You Die". I was surprised that "Yell for help!!" wasn't one of them

Posting Permissions

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