>I have this script that I run on a regular basis. I have a DECLARE tableIndexes CURSOR FOR that is inserted at several places in the script. But, if the script didn't run well on the last time, when I run the script again, I might have this error:
>
>"A cursor with the name 'tableIndexes' already exists."
>
>How can I make sure all cursor are cleaned before I start running the script.
Check DEALLOCATE command in BOL.
DEALLOCATE @MyCursor
If it's not broken, fix it until it is.
My Blog