在SQL中如何将行数计数保存到游标中

@@CURSOR_ROWS 系统函数

@@CURSOR_ROWS 系统函数用于查找结果集中的行数。 @@CURSOR_ROWS 系统函数仅适用于静态游标。 它不适用于动态游标。

使用@@FETCH_STATUS 系统函数的语句

fetch first from cur_invinfo
while @@FETCH_STATUS = 0
begin
	fetch next from cur_invinfo
end

使用@@cursor_rows 系统函数的语句

print("结果集中共有")
print convert(varchar,@@cursor_rows)
print('行')
日期:2020-06-02 22:17:50 来源:oir作者:oir