I am working on a large Integrated accounting package using SQL Server as
the back end. One of the required tables is a checkbook which must be able
to handle hundreds of thousands of records, and maintain a running balance.
We decided to implement this using a field in the table which is
maintained with triggers. The insert finds the last check and calculates
the new balance by updating the table. The update trigger finds every
check that would be affected by the new balance change and updates from
there. The delete does the same as the update. We use stored procedures
called from the triggers to avoid duplication of code, and to allow the
whole table to be updated at once. The stored procedures by themselves
work fine, but when we call them from the triggers we get Error 1203.
Caller of lock manager is incorrectly trying to unlock an unlocked object.
This error keeps happening until the server gets a stack overflow and SQL
terminates. Needless to say this is not a good thing. The help on this
error says run the DBCC CheckTable and CheckDB, but these have reported
nothing out of the ordinary. We moved just these tables and triggers into
a separate database with no luck. The table by itself behaves normally as
do the stored procedures. No end in sight on this one. Anything anyone
can think of would be greatly appreciated.