Rupesh
Rupesh

Reputation: 13

T-SQL stored procedure cursor error

The same stored procedure is executed on two different databases with different values, in one it's getting executed, in the other, it's throwing an error

A cursor with the name 'ActivityQuizCursor' already exists

Both database are identical in structure.

Upvotes: 0

Views: 60

Answers (1)

The beginner
The beginner

Reputation: 622

You are using global cursor that will be defined each time you are calling this procedure and give you the same error.

Define a local cursor. Just put the keyword LOCAL after CURSOR:

declare ActivityQuizCursor CURSOR LOCAL FOR

Upvotes: 1

Related Questions