Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how use loks into the tables

Author  Topic 

boreddy
Posting Yak Master

172 Posts

Posted - 2011-06-10 : 04:51:35
Hi Expers

In My database i have table which contains the 70k data
this tables is used for all reports and so many casess

here i have one requirement

One of the case when i try to query from table others will not get the data untill i completed my query(In this case i am using some time select some time updata )
is this possible to do by usning the lock

Thanks In advance

lappin
Posting Yak Master

182 Posts

Posted - 2011-06-10 : 06:00:04
You can query a table without locking it by:
Select [yourColumnName] from YourTable with (nolock)

But you should check if your table is indexed correctly - this will speed your queries and so minimise locking. How long does your query take to run?
Go to Top of Page

ahmeds08
Aged Yak Warrior

737 Posts

Posted - 2011-06-10 : 07:48:36
70k is not big...please check for the indexes as lappin said..
Go to Top of Page

boreddy
Posting Yak Master

172 Posts

Posted - 2011-06-10 : 09:00:28
my query is running more than 5 min

quote:
Originally posted by lappin

You can query a table without locking it by:
Select [yourColumnName] from YourTable with (nolock)

But you should check if your table is indexed correctly - this will speed your queries and so minimise locking. How long does your query take to run?

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-06-12 : 04:36:48
seems like you're using transaction
Also using nolock can cause dirty reads

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -