Friday, March 23, 2012

Read from tables when another transactions isolationlevel is ReadCommited

I need to be able to read from tables while a transaction is running. This
transaction could take 20-30 minutes. I don't want to be able to read
uncommitted data that has been written in this transaction though.
I looked at NOLOCK but that says it reads uncommitted data.
Any suggestions?READPAST allows you to read past the locked rows.
Keith
"Joe" <J_no_spam@._no_spam_Fishinbrain.com> wrote in message
news:eLo9e5$SFHA.2096@.TK2MSFTNGP14.phx.gbl...
>I need to be able to read from tables while a transaction is running. This
> transaction could take 20-30 minutes. I don't want to be able to read
> uncommitted data that has been written in this transaction though.
> I looked at NOLOCK but that says it reads uncommitted data.
> Any suggestions?
>|||With nolock you could read dirty rows. In this case you'd be safe to read
committed.
"Joe" <J_no_spam@._no_spam_Fishinbrain.com> wrote in message
news:eLo9e5$SFHA.2096@.TK2MSFTNGP14.phx.gbl...
>I need to be able to read from tables while a transaction is running. This
> transaction could take 20-30 minutes. I don't want to be able to read
> uncommitted data that has been written in this transaction though.
> I looked at NOLOCK but that says it reads uncommitted data.
> Any suggestions?
>|||If the isolation level is set to ReadCommited for the transaction, does that
cause the table to lock or just the rows being inserted, updated?
If it only effects the inserted and updated then the READPAST will work.
Is there anyway to perform the write while within a transaction without
locking the tables at all?
"Keith Kratochvil" <sqlguy.back2u@.comcast.net> wrote in message
news:uRnvitATFHA.3152@.TK2MSFTNGP12.phx.gbl...
> READPAST allows you to read past the locked rows.
> --
> Keith
>
> "Joe" <J_no_spam@._no_spam_Fishinbrain.com> wrote in message
> news:eLo9e5$SFHA.2096@.TK2MSFTNGP14.phx.gbl...
This
>|||Hello Joe,
Could find a solution? I've a case same with yours. READPAST works and I can
read unlocked rows. But do you know a way to also read locked rows with the
ir original (before lock) values?sql

No comments:

Post a Comment