SQL Server Performance Forum – Threads Archive
Select Query Problem – lockingHi there, Am having a problem with a simple select query – just hangs.
Query along lines of:
"select * from smalltable". Problem seem to be that the table/record is locked by another process.
I am running the sql in query analyser.
Strangely, when I use a 3rd party reporting tool, all the records are returned
without any problem! Any idea how I can overcome this? I assume that the 3rd party reporting tool is reading "dirty" records….? Can T-SQL not do the same? Many thanks in advance!
select * from smalltable with(nolock) allows dirty reads. Wouldn’t it be better to fix the locking though? MeanOldDBA
[email protected] When life gives you a lemon, fire the DBA.
You can change the isolation level for that query: In Query Analyzer, you can do this: SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
GO BEGIN TRANSACTION SELECT *
FROM smalltable COMMIT TRANSACTION
thanks a lot – it works!