Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Finding open cursors

Author  Topic 

blakmk
Starting Member

45 Posts

Posted - 2003-04-16 : 05:05:14
Does anyone know a way of finding out how many cursors are open on a particular database?



macka
Posting Yak Master

162 Posts

Posted - 2003-04-16 : 06:01:09
blakmk,

SELECT COUNT(*) AS open_cursors
FROM master..syscursortables ct
INNER JOIN master..syscursors c ON ct.cursor_handle = c.cursor_handle
WHERE dbname='Northwind'

Cheers,

macka.

--
There are only 10 types of people in the world - Those who understand binary, and those who don't.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-04-16 : 08:56:01
I would think the answer should be: ZERO!

Don't forget to CLOSE and DEALLOCATE

On second thought, avoid CURSORS like the plague.

The only time you should have to use a CURSOR is when you need to pass parameters to a command

See Tara's response in this thread:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=25405

PS Why do you need to know what's Open out there?




Brett

8-)
Go to Top of Page
   

- Advertisement -