Home > Archive > Microsoft SQL Server forum > June 2005 > Testing for cursor's existence









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Testing for cursor's existence
Bruno Panetta

2005-06-10, 7:23 am

How is it possible to test at the beginning of a stored procedure if a
cursor I want to declare already exists? (So I don't cause an error by
declaring it).
Thanks

Bruno

Simon Hayes

2005-06-10, 7:23 am

See CURSOR_STATUS() in Books Online, but if the cursor should only
exist within the stored procedure, then you can declare it as LOCAL to
avoid name problems.

Simon

David Portas

2005-06-10, 7:23 am

Use local rather than global cursors then you won't have to worry.
Avoid using cursors at all where you can.

--
David Portas
SQL Server MVP
--

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com