--游标一共有三种情况,可以用如下语句检查:
declare @游标名 sysname
set @游标名='要检查的游名'
select case cursor_status('local',@游标名)
when -3 then '不存在名为 ['+@游标名+'] 的局部游标'
else '名为 ['+@游标名+'] 的局部游标已经定义' end
,case cursor_status('global',@游标名)
when -3 then '不存在名为 ['+@游标名+'] 的全局游标'
else '名为 ['+@游标名+'] 的全局游标已经定义' end
,case cursor_status('variable',@游标名)
when -3 then '不存在名为 ['+@游标名+'] 的游标变量'
else '名为 ['+@游标名+'] 的游标变量已经定义' end
游标一共有三种情况,可以用如下语句检查:
最新推荐文章于 2023-05-14 23:05:46 发布