Results 1 to 4 of 4
  1. #1
    Join Date
    May 2003
    Posts
    12

    Unanswered: View DML question

    Hi,

    I am looking for any information regarding viewing the records that were deleted from a delete statement within an open transaction before committing the transaction. I have found little information on how to do this in SQL 2000, but uncovered how it is done in SQL 2005. Perhaps this is not possible in 2000?

    --These are the steps I would like to perform...

    begin tran

    delete from orders where orderno = 1

    select * from deleted (this is the syntax inside a trigger to view the records in the virtual delete table)

    --If I am happy with what was deleted, commit

    commit tran

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Why not check what records are going to be deleted FIRST?

    select * from orders where orderno = 1

    --If I am happy with what was deleted, commit
    delete from orders where orderno = 1
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    May 2003
    Posts
    12
    That is true and is what I usually do for any delete. However, other database engines actually provide the ability to see which records are marked for deletion before the transaction is committed. I was just curious if that same functionality exists in SQL Server 2000.

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Only through the "deleted" tables accessible within a trigger.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

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