A cursor with the name ... already exists - SQL Server 2008

Viewed 26165

I have a trigger that is used to perform some auditing tasks when changes are made to a table. Within this trigger there is a WHILE loop, and in the loop there is a cursor that is declared, used, closed and then deallocated before the next iteration of the loop.

When I call a stored procedure that changes the table and in turn causes the trigger to run, and I do this from within the Management Studio, all works as expected.

However, when this stored procedure is called from within my Java web application, I get an error: "A cursor with the name ... already exists".

Is there a reason why this stored procedure would work when I execute it manually, and not work when run from the web application?

3 Answers
Related