Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

avoiding blocking 1

Status
Not open for further replies.

azwaan

Programmer
Jan 11, 2002
42
hi..

i have a periodic job running on a table. the job script includes a transaction. there is a separate .NET application accessing the table for data reads. due to the very large frequency of data reads, i need to avoid blocking by the job. how can i achieve this?

the following is a sample script.. which i use to test this scenario.. i have noticed that despite using the various isolation levels, the .NET application is blocked from reading data and times out.

SET TRANSACTION ISOLATION LEVEL READ COMMITTED ;
declare @count as int;
BEGIN TRANsaction;
SET @count=1;
WHILE @count<100
BEGIN
Update MasterVersion set VersionID= VersionID +1 ;
WAITFOR DELAY '00:01';
END
COMMIT transaction;
GO


any suggestions?
 
Do the SELECT statements used by the .NET application include the hint WITH (NOLOCK)?

This might help.

Bob Boffin
 
Thanks , i also found out if you are actually doing the reads using a SP. you could use the following to avoid a block.

SET TRANSACTION ISOLATION LEVEL SNAPSHOT
Select * from MasterVersion

however u need to enable SnapShots at the DB level prior to this using

ALTER DATABASE DbName SET ALLOW_SNAPSHOT_ISOLATION ON



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top