hi, i want to use TABLOCKX lock on my table. i have used same query given in above post. but problem is lock does not get released after completion of transaction holding lock on table. hence another transaction keeps waiting. following are my 2 query i tried in query analyzer of sql server. Please help me... Query 1: BEGIN TRAN A SELECT * FROM alerts with (TABLOCKX, HOLDLOCK) declare @cnt bigint set @cnt = 1000000 print 'start time = '+cast(getdate() as varchar) while @cnt > 0 begin print 'Cnt = ' + cast(@cnt as varchar) set @cnt = @cnt - 1 end print 'end time = '+cast(getdate() as varchar) COMMIT TRAN A ----------------------------------------------------------------------------------- Query 2: BEGIN TRAN B print 'start time = '+cast(getdate() as varchar) SELECT * FROM alerts --with (TABLOCKX) print 'end time = '+cast(getdate() as varchar) COMMIT TRAN B Please let me know if i'm doing anything wrong. Thank in advance... Rajesh.
R
Rajesh Awate
@Rajesh Awate