提示错误:
======================================================
服务器: 消息 16916,级别 16,状态 1,过程 test,行 99
名为 'm_curTemp' 的游标不存在。
服务器: 消息 16916,级别 16,状态 1,过程 test,行 100
名为 'm_curTemp' 的游标不存在。
服务器: 消息 16916,级别 16,状态 1,过程 test,行 106
名为 'm_curTemp' 的游标不存在。
服务器: 消息 16916,级别 16,状态 1,过程 test,行 107
名为 'm_curTemp' 的游标不存在。
======================================================
服务器: 消息 16916,级别 16,状态 1,过程 test,行 99
名为 'm_curTemp' 的游标不存在。
服务器: 消息 16916,级别 16,状态 1,过程 test,行 100
名为 'm_curTemp' 的游标不存在。
服务器: 消息 16916,级别 16,状态 1,过程 test,行 106
名为 'm_curTemp' 的游标不存在。
服务器: 消息 16916,级别 16,状态 1,过程 test,行 107
名为 'm_curTemp' 的游标不存在。
' open m_curTemp'
+' fetch absolute @m_intStartRecord from m_curTemp'
+' while @@fetch_status = 0'
+' fetch next from m_curTemp'
+' --关闭指针'
+' close m_curTemp'
+' deallocate m_curTemp'
exec(@str)
set rowcount 0
FOR select_statement
[ FOR { READ ONLY | UPDATE [ OF column_name [ ,...n ] ] } ]标准的SQL-92语法如上
必须有for select_statement语句只定一个CURSOR,不指定它所对应的记录集是不行的
' open m_curTemp'
+' fetch absolute '+cast(@m_intStartRecord as varchar(10))+' from m_curTemp'
+' while @@fetch_status = 0'
+' fetch next from m_curTemp'
+' --关闭指针'
+' close m_curTemp'
+' deallocate m_curTemp'
exec(@str)
set rowcount 0
我看你的几个脚本返回的结果集的字段都是相同的,我想最好建一个临时表temptable,然后定义cursor for select * from temptable
再将数据insert到temptable中
再open cursor没试过,感觉是一可行之路
不知道哪个效率好
select * from ...这种,
而不是
@str='select * from ...'
exec(@str)