set @SQLString = 'DECLARE cursor_FRModalRows cursor for SELECT '+@curModalLineFieldName+' FROM '+@curFRModalTableName exec(@SQLString) open cursor_FRModalRows fetch cursor_FRModalRows into @i while @@fetch_status=0 begin print @i fetch cursor_FRModalRows into @i end close cursor_FRModalRows deallocate cursor_FRModalRows
exec(@SQLString)
open cursor_FRModalRows
fetch cursor_FRModalRows into @i
while @@fetch_status=0
begin
print @i
fetch cursor_FRModalRows into @i
end
close cursor_FRModalRows
deallocate cursor_FRModalRows
与exec sp_executesql @SQLString的 区别在此?