SQL SERVER - 如何检测游标cursor是否打开?

发布时间 2023-03-31 12:15:18作者: po-A

 

IF CURSOR_STATUS('global', 'mycursor') >= 0
BEGIN
PRINT 'Cursor exists and is open';
END
ELSE
BEGIN
PRINT 'Cursor does not exist or is not open';
END;

 

 

 

 

REF:https://stacktuts.com/how-to-check-if-cursor-exists-open-status-in-sql