Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine CURSOR state within CATCH block

Status
Not open for further replies.

ousoonerjoe

Programmer
Jun 12, 2007
925
US
Using: SQL 2008 R2

I've come across some old procedures that need error trapping, but have CURSOR(s) in them.

How do I determine the Cursor's state to test if it needs to be closed and/or deallocated from within the CATCH block?

What happens to the Cursor when there is an error or RAISERROR and the stored procedure terminates without closing and deallocating it?

I know they should be completely re-written to get rid of the CURSOR, but unfortunately, is not a viable option at this time. Any suggestions are appreciated. Thank you.

--------------------------------------------------
“Crash programs fail because they are based on the theory that, with nine women pregnant, you can get a baby a month.” --Wernher von Braun
--------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top