Results 1 to 2 of 2

Thread: Begin Commit Transactions

  1. #1
    Renato Guest

    Begin Commit Transactions

    Many times i write stoted procedures with transaction blocks.
    I have delete a row after begin transaction and in continue i
    read from table the select statement get back the deleted row:

    begin tran
    delete mytable
    where id = @myid
    and seqid = 3

    select sum(balance)
    from mytable
    where id = @myid

    ............
    ...............
    commit tran
    .... OR
    rollback tran

    the sum(balance) function has calculate the balance of row 3
    I use SQL 7.0

    Thanks
    Renato


  2. #2
    phil McCormack Guest

    Begin Commit Transactions (reply)

    Because the delete and the select are part of the same transaction, you will see the virtually deleted row until the delete is committed. If you MUST have the select inside the transaction, use the deleted table and a NOT EXISTS clause to exclude the deleted rows.


    ------------
    Renato at 3/14/01 5:24:01 PM

    Many times i write stoted procedures with transaction blocks.
    I have delete a row after begin transaction and in continue i
    read from table the select statement get back the deleted row:

    begin tran
    delete mytable
    where id = @myid
    and seqid = 3

    select sum(balance)
    from mytable
    where id = @myid

    ............
    ...............
    commit tran
    .... OR
    rollback tran

    the sum(balance) function has calculate the balance of row 3
    I use SQL 7.0

    Thanks
    Renato


Posting Permissions

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