| Author |
SQL server locking dirty reads
|
|
|
| We use an application to view order information and open up an order in the
application. When I use SQL statements to try and get that order from the
database the query doesnt come back until I close the application window
which has the order opened. I have tried using NOLOCKS to get the data but
its still wont read.
Example : Select * from Orders NOLOCK where OrderID = 2
Anyone got any ideas what is going on?
| |
| Daniel Crichton 2006-02-16, 11:23 am |
| John wrote on Thu, 16 Feb 2006 16:27:17 +0100:
> We use an application to view order information and open up an order in
> the application. When I use SQL statements to try and get that order from
> the database the query doesnt come back until I close the application
> window which has the order opened. I have tried using NOLOCKS to get the
> data but its still wont read.
>
> Example : Select * from Orders NOLOCK where OrderID = 2
The above query sets NOLOCK as an alias for the Orders table.
Use
SELECT * FROM Orders WITH (NOLOCK) WHERE OrderID = 2
to allow you to read the order. However, just remember that the data you're
reading may not be the actual order data as the changes may be rolled back.
Dan
| |
|
|
"John" <jhughesy@msn.com> wrote in message
news:uj8$L3wMGHA.2036@TK2MSFTNGP14.phx.gbl...
> We use an application to view order information and open up an order in
> the application. When I use SQL statements to try and get that order from
> the database the query doesnt come back until I close the application
> window which has the order opened. I have tried using NOLOCKS to get the
> data but its still wont read.
>
> Example : Select * from Orders NOLOCK where OrderID = 2
>
> Anyone got any ideas what is going on?
Using : 'WITH (NOLOCK)' works
|
|
|
|