Home > Database > Mysql Tutorial > 如何查看当前Open的Cursor

如何查看当前Open的Cursor

WBOY
Release: 2016-06-07 15:23:02
Original
1528 people have browsed it

遇到错误:A cursor with thename already exists,想要看是什么代码导致的。找到下面几种方法. --测试声明Cursor并且打开 DECLARE vend_cursor CURSOR FOR SELECT * FROMPurchasing.Vendor OPEN vend_cursor FETCH NEXTFROMvend_cursor; --使用下面的三种方

遇到错误:A cursor with thename ' ' already exists,想要看是什么代码导致的。找到下面几种方法.

--测试声明Cursor并且打开

DECLARE vend_cursor CURSOR

FOR SELECT * FROMPurchasing.Vendor

OPEN vend_cursor

FETCH NEXTFROMvend_cursor;

--使用下面的三种方法都可以

SELECT ec.session_id,ec.name,ec.properties,ec.creation_time,ec.is_open,ec.writes,ec.reads,t.text

FROM sys.dm_exec_cursors(0)ec

CROSS APPLYsys.dm_exec_sql_text(ec.sql_handle)t

dbcc activecursors(0)

SELECT *FROMMASTER..SYSCURSORS

结果:

\

看起来DMV的结果更全面。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template