delete operation blocked by an open select in different CSession
- From: "Rudolf Wiener" <r.wiener@xxxxxxxx>
- Date: Thu, 04 Jan 2007 18:00:26 +0100
I'm using VC++/VStudio 2003 and MSSQL Server 2000.
I open up two different CSession objects, connecting to the same DB. In CSession 1 I open a CCommand object for reading through the DB. This CCommand stays open throughout the application. The select stmt refers to 3 different tables, using join clauses.
Because I need to delete a record from one of these tables I open up a second CCommand object in a different CSession. This second CCommand issues a SQL 'delete from tableA where fieldA=22'.
The delete hangs and is never finished (well, I waited only for a couple of minutes).
The strange thing is: if I reduce the select stmt of CSession 1 in a way that it refers to 2 tables only, then everything works fine. It does not matter which of the 3 tables I remove from the select stmt. As long as there are only 2 tables involved, the delete won't be blocked.
Here's the select stmt of CSession 1:
select * from tableA join tableB on (fieldA = fieldB) left outer join tableC on (fieldC = fieldB);
and this is the delete oc CSession 2:
delete from tableA where fieldA=22;
Any insights, any hints?
Regards
Rudi
.
- Follow-Ups:
- Re: delete operation blocked by an open select in different CSession
- From: Erland Sommarskog
- Re: delete operation blocked by an open select in different CSession
- Next by Date: Re: delete operation blocked by an open select in different CSession
- Next by thread: Re: delete operation blocked by an open select in different CSession
- Index(es):