Just my opinion:
In most normal circumstances I would disagree with this.
Currently our commands will wait for thirty seconds to timeout, so the
transaction will have to be active for at least that long. This is an
outrageous amount of time to have a transaction active during production and
you should take a hard look at what you are doing that is taking too long.
Make your update logic as tight as possible, open the connection as late as
possible and close it as soon as you can and make your transactions as
atomic as feasible.
If your scenario is not a "normal" production scenario, that is if you are
doing admin work or bulk copying large amounts of data in pre-production
take a look at the NOLOCK Tsql Statement. You can also use the
ReadUncommited isolation level, but not the way you tried it. ReadUncommited
iso level places the same locks as ReadCommited, what makes it special is
that it ignores locks placed by other transactions. So if lock a table and
update values while in one transaction I can, in a different connection,
start a readuncommited iso level transaction and look at the values updated
by the first transaction. This is not something I would use in production.
Happy programming.
--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
"David Browne" <davidbaxterbrowne no potted meat@hotmail.com> wrote in
message news:uRXU4cJ9DHA.1632@TK2MSFTNGP12.phx.gbl...
[quoted text, click to view] >
> "wrxguru" <wrxguru@iprimus.com-dot-au.no-spam.invalid> wrote in message
> news:402ff4b3$1_2@Usenet.com...
> > Yes, my update spans several tables and the problem is I have inserted
> > records into the product table but when i use another connection (via
> > a sql reader as i have general functions to lookup for the latest
> > item id for example) to see the product table i get locked out
> > because the transaction has got the whole table locked no matter what
> > isolation i use. i thought another connection would be able to see
> > the table at least to read if the isolation level was read
> > uncomitted?
> >
>
> Looks like your real problem is that you are using multiple connections.
> You need to restructure your DAL methods so they can all share a
connection
> for the duration of your transaction. You can read through the locks with
> certian settings on your reading transaction, but you really don't want
to.
> What if another connection had made uncommited changes to the data you are
> querying?
>
> David
>
>