Home > Archive > MS SQL Server > February 2006 > SQL server locking dirty reads









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SQL server locking dirty reads
John

2006-02-16, 11:23 am

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

2006-02-16, 11:23 am


"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



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com