SQLTeam.com | Weblogs | Forums

Table blocked on some records

I have a stored procedure that processes data and writes it to a result table

I do not use any transaction in this procedure and it works well on SQL

If I run it from my application (django), the target table is blocked


I initiate this procedure for an employee (for example, the number 100)

By making a select on this table (after processing) the blocking is done only on the employee treated by django

Select * from mytable where matricule = 100 (blocking)
Select * from mytable where matricule = xxx (no blocking) knowing that xxx was processed directly on SQL

The solution I found:

I stop the SQL service and I restart it, the table is unlocked

NB: it is not the whole table that is blocked

what to do

I would spy on the SQL e.g. using SQL PROFILER and see what locking hints are being used, and then trace that back to where in the APP the locks are being issued.