Home > Archive > Microsoft SQL Server forum > August 2005 > Count of open cursors SQL Server?









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 Count of open cursors SQL Server?
cynical86

2005-08-02, 12:24 pm

Hello All,

Thanks for reading my question.

I am trying to find out how many open cursors exist at a particular time on a SQL Server instance. I was able to google this for Oracle, but no luck with SQL Server.

There are tables in master that seem likely (dbo.syscursor*), but I never find any rows in them, even when I am definitely holding a cursor open (code below, in case I am missing something).

Does anyone have any suggestions on this? Thanks so much for your time.

Eric

---------------------------------------
declare @docnum int
declare longtime cursor for
select transactionnum
from somelargelogtable
where (transactionnum /2) > 100

open longtime
fetch next from longtime into @docnum
while (@@fetch_status = 0)
begin
print @docnum
waitfor delay '00:05'
fetch next from longtime into @docnum
end
close longtime
deallocate longtime
---------------------------------------
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