Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004

    Unanswered: select statement and transaction

    for example i have a table
    and i update a column
    using this query:

    begin tran
    update table1
    set column1='something where column2='otherthing'
    i dont give the "commit tran" statement
    but when i give a select statement on table1
    select column1 from table1
    where column2='otherthing'
    i find the change has been effected eventhough i have not given the commit tran command

    can somebody explain me pls

  2. #2
    Join Date
    Nov 2002
    Here's an experiment for you...

    Re-run the test you did and leave the transaction uncommitted. However, this time, open up another Query Analyzer windows/session. Do the select again. What happens? You should find that it hangs. That's because there are locks in place. Now go back to the first QA session and commit the transation. Go back to the second QA session and see what happens... The select should complete.

    It's interesting that SQL Server puts a table lock on when you might think that a row lock would be sufficient. What do the experts have to say about this?


  3. #3
    Join Date
    Apr 2004

    trans and lock

    ya u were rite not able to select on that table in a new query analyser window.
    pls crichardson can u explain me in detail more about locks and its use
    where it is necessary and where it is redundant
    pls dont pick passages from sql help

Posting Permissions

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