declare @nvar_sql nvarchar(2000)
create table ##tmp (name varchar(10))
set @nvar_sql='select name into ##tmp from testtbl'
exec(@nvar_sql)
declare blur_cur scroll cursor for Select * from ##tmp...
drop table ##tmp
create table ##tmp (name varchar(10))
set @nvar_sql='select name into ##tmp from testtbl'
exec(@nvar_sql)
declare blur_cur scroll cursor for Select * from ##tmp...
drop table ##tmp
set @sqlstr='declare a cursor for select * from t'
exec(@sqlstr)
open a
fetch next from a
as
..
set @nvar_sql='select name from testtbl'
Exec(@nvar_sql)
go然后
create table #tmp (name varchar(10))
insert #tmp exec test1
declare blur_cur scroll cursor for Select * from #tmp...
drop table #tmp
set @nvar_sql='declare a cursor for select name from testtbl'
exec(nvar_sql)
open a
fetch next from a
set @nvar_sql='declare blur_cur cursor for select name from testtbl' open blur_cur